trade_utils.cpp 949 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706
  1. /* Generated by Cython 0.29.15 */
  2. /* BEGIN: Cython Metadata
  3. {
  4. "distutils": {
  5. "depends": [],
  6. "language": "c++",
  7. "name": "app.trade.trade_utils",
  8. "sources": [
  9. "app/trade/trade_utils.pyx"
  10. ]
  11. },
  12. "module_name": "app.trade.trade_utils"
  13. }
  14. END: Cython Metadata */
  15. #define PY_SSIZE_T_CLEAN
  16. #include "Python.h"
  17. #ifndef Py_PYTHON_H
  18. #error Python headers needed to compile C extensions, please install development version of Python.
  19. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
  20. #error Cython requires Python 2.6+ or Python 3.3+.
  21. #else
  22. #define CYTHON_ABI "0_29_15"
  23. #define CYTHON_HEX_VERSION 0x001D0FF0
  24. #define CYTHON_FUTURE_DIVISION 1
  25. #include <stddef.h>
  26. #ifndef offsetof
  27. #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
  28. #endif
  29. #if !defined(WIN32) && !defined(MS_WINDOWS)
  30. #ifndef __stdcall
  31. #define __stdcall
  32. #endif
  33. #ifndef __cdecl
  34. #define __cdecl
  35. #endif
  36. #ifndef __fastcall
  37. #define __fastcall
  38. #endif
  39. #endif
  40. #ifndef DL_IMPORT
  41. #define DL_IMPORT(t) t
  42. #endif
  43. #ifndef DL_EXPORT
  44. #define DL_EXPORT(t) t
  45. #endif
  46. #define __PYX_COMMA ,
  47. #ifndef HAVE_LONG_LONG
  48. #if PY_VERSION_HEX >= 0x02070000
  49. #define HAVE_LONG_LONG
  50. #endif
  51. #endif
  52. #ifndef PY_LONG_LONG
  53. #define PY_LONG_LONG LONG_LONG
  54. #endif
  55. #ifndef Py_HUGE_VAL
  56. #define Py_HUGE_VAL HUGE_VAL
  57. #endif
  58. #ifdef PYPY_VERSION
  59. #define CYTHON_COMPILING_IN_PYPY 1
  60. #define CYTHON_COMPILING_IN_PYSTON 0
  61. #define CYTHON_COMPILING_IN_CPYTHON 0
  62. #undef CYTHON_USE_TYPE_SLOTS
  63. #define CYTHON_USE_TYPE_SLOTS 0
  64. #undef CYTHON_USE_PYTYPE_LOOKUP
  65. #define CYTHON_USE_PYTYPE_LOOKUP 0
  66. #if PY_VERSION_HEX < 0x03050000
  67. #undef CYTHON_USE_ASYNC_SLOTS
  68. #define CYTHON_USE_ASYNC_SLOTS 0
  69. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  70. #define CYTHON_USE_ASYNC_SLOTS 1
  71. #endif
  72. #undef CYTHON_USE_PYLIST_INTERNALS
  73. #define CYTHON_USE_PYLIST_INTERNALS 0
  74. #undef CYTHON_USE_UNICODE_INTERNALS
  75. #define CYTHON_USE_UNICODE_INTERNALS 0
  76. #undef CYTHON_USE_UNICODE_WRITER
  77. #define CYTHON_USE_UNICODE_WRITER 0
  78. #undef CYTHON_USE_PYLONG_INTERNALS
  79. #define CYTHON_USE_PYLONG_INTERNALS 0
  80. #undef CYTHON_AVOID_BORROWED_REFS
  81. #define CYTHON_AVOID_BORROWED_REFS 1
  82. #undef CYTHON_ASSUME_SAFE_MACROS
  83. #define CYTHON_ASSUME_SAFE_MACROS 0
  84. #undef CYTHON_UNPACK_METHODS
  85. #define CYTHON_UNPACK_METHODS 0
  86. #undef CYTHON_FAST_THREAD_STATE
  87. #define CYTHON_FAST_THREAD_STATE 0
  88. #undef CYTHON_FAST_PYCALL
  89. #define CYTHON_FAST_PYCALL 0
  90. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  91. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  92. #undef CYTHON_USE_TP_FINALIZE
  93. #define CYTHON_USE_TP_FINALIZE 0
  94. #undef CYTHON_USE_DICT_VERSIONS
  95. #define CYTHON_USE_DICT_VERSIONS 0
  96. #undef CYTHON_USE_EXC_INFO_STACK
  97. #define CYTHON_USE_EXC_INFO_STACK 0
  98. #elif defined(PYSTON_VERSION)
  99. #define CYTHON_COMPILING_IN_PYPY 0
  100. #define CYTHON_COMPILING_IN_PYSTON 1
  101. #define CYTHON_COMPILING_IN_CPYTHON 0
  102. #ifndef CYTHON_USE_TYPE_SLOTS
  103. #define CYTHON_USE_TYPE_SLOTS 1
  104. #endif
  105. #undef CYTHON_USE_PYTYPE_LOOKUP
  106. #define CYTHON_USE_PYTYPE_LOOKUP 0
  107. #undef CYTHON_USE_ASYNC_SLOTS
  108. #define CYTHON_USE_ASYNC_SLOTS 0
  109. #undef CYTHON_USE_PYLIST_INTERNALS
  110. #define CYTHON_USE_PYLIST_INTERNALS 0
  111. #ifndef CYTHON_USE_UNICODE_INTERNALS
  112. #define CYTHON_USE_UNICODE_INTERNALS 1
  113. #endif
  114. #undef CYTHON_USE_UNICODE_WRITER
  115. #define CYTHON_USE_UNICODE_WRITER 0
  116. #undef CYTHON_USE_PYLONG_INTERNALS
  117. #define CYTHON_USE_PYLONG_INTERNALS 0
  118. #ifndef CYTHON_AVOID_BORROWED_REFS
  119. #define CYTHON_AVOID_BORROWED_REFS 0
  120. #endif
  121. #ifndef CYTHON_ASSUME_SAFE_MACROS
  122. #define CYTHON_ASSUME_SAFE_MACROS 1
  123. #endif
  124. #ifndef CYTHON_UNPACK_METHODS
  125. #define CYTHON_UNPACK_METHODS 1
  126. #endif
  127. #undef CYTHON_FAST_THREAD_STATE
  128. #define CYTHON_FAST_THREAD_STATE 0
  129. #undef CYTHON_FAST_PYCALL
  130. #define CYTHON_FAST_PYCALL 0
  131. #undef CYTHON_PEP489_MULTI_PHASE_INIT
  132. #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  133. #undef CYTHON_USE_TP_FINALIZE
  134. #define CYTHON_USE_TP_FINALIZE 0
  135. #undef CYTHON_USE_DICT_VERSIONS
  136. #define CYTHON_USE_DICT_VERSIONS 0
  137. #undef CYTHON_USE_EXC_INFO_STACK
  138. #define CYTHON_USE_EXC_INFO_STACK 0
  139. #else
  140. #define CYTHON_COMPILING_IN_PYPY 0
  141. #define CYTHON_COMPILING_IN_PYSTON 0
  142. #define CYTHON_COMPILING_IN_CPYTHON 1
  143. #ifndef CYTHON_USE_TYPE_SLOTS
  144. #define CYTHON_USE_TYPE_SLOTS 1
  145. #endif
  146. #if PY_VERSION_HEX < 0x02070000
  147. #undef CYTHON_USE_PYTYPE_LOOKUP
  148. #define CYTHON_USE_PYTYPE_LOOKUP 0
  149. #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
  150. #define CYTHON_USE_PYTYPE_LOOKUP 1
  151. #endif
  152. #if PY_MAJOR_VERSION < 3
  153. #undef CYTHON_USE_ASYNC_SLOTS
  154. #define CYTHON_USE_ASYNC_SLOTS 0
  155. #elif !defined(CYTHON_USE_ASYNC_SLOTS)
  156. #define CYTHON_USE_ASYNC_SLOTS 1
  157. #endif
  158. #if PY_VERSION_HEX < 0x02070000
  159. #undef CYTHON_USE_PYLONG_INTERNALS
  160. #define CYTHON_USE_PYLONG_INTERNALS 0
  161. #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
  162. #define CYTHON_USE_PYLONG_INTERNALS 1
  163. #endif
  164. #ifndef CYTHON_USE_PYLIST_INTERNALS
  165. #define CYTHON_USE_PYLIST_INTERNALS 1
  166. #endif
  167. #ifndef CYTHON_USE_UNICODE_INTERNALS
  168. #define CYTHON_USE_UNICODE_INTERNALS 1
  169. #endif
  170. #if PY_VERSION_HEX < 0x030300F0
  171. #undef CYTHON_USE_UNICODE_WRITER
  172. #define CYTHON_USE_UNICODE_WRITER 0
  173. #elif !defined(CYTHON_USE_UNICODE_WRITER)
  174. #define CYTHON_USE_UNICODE_WRITER 1
  175. #endif
  176. #ifndef CYTHON_AVOID_BORROWED_REFS
  177. #define CYTHON_AVOID_BORROWED_REFS 0
  178. #endif
  179. #ifndef CYTHON_ASSUME_SAFE_MACROS
  180. #define CYTHON_ASSUME_SAFE_MACROS 1
  181. #endif
  182. #ifndef CYTHON_UNPACK_METHODS
  183. #define CYTHON_UNPACK_METHODS 1
  184. #endif
  185. #ifndef CYTHON_FAST_THREAD_STATE
  186. #define CYTHON_FAST_THREAD_STATE 1
  187. #endif
  188. #ifndef CYTHON_FAST_PYCALL
  189. #define CYTHON_FAST_PYCALL 1
  190. #endif
  191. #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
  192. #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  193. #endif
  194. #ifndef CYTHON_USE_TP_FINALIZE
  195. #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  196. #endif
  197. #ifndef CYTHON_USE_DICT_VERSIONS
  198. #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  199. #endif
  200. #ifndef CYTHON_USE_EXC_INFO_STACK
  201. #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  202. #endif
  203. #endif
  204. #if !defined(CYTHON_FAST_PYCCALL)
  205. #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
  206. #endif
  207. #if CYTHON_USE_PYLONG_INTERNALS
  208. #include "longintrepr.h"
  209. #undef SHIFT
  210. #undef BASE
  211. #undef MASK
  212. #ifdef SIZEOF_VOID_P
  213. enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  214. #endif
  215. #endif
  216. #ifndef __has_attribute
  217. #define __has_attribute(x) 0
  218. #endif
  219. #ifndef __has_cpp_attribute
  220. #define __has_cpp_attribute(x) 0
  221. #endif
  222. #ifndef CYTHON_RESTRICT
  223. #if defined(__GNUC__)
  224. #define CYTHON_RESTRICT __restrict__
  225. #elif defined(_MSC_VER) && _MSC_VER >= 1400
  226. #define CYTHON_RESTRICT __restrict
  227. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  228. #define CYTHON_RESTRICT restrict
  229. #else
  230. #define CYTHON_RESTRICT
  231. #endif
  232. #endif
  233. #ifndef CYTHON_UNUSED
  234. # if defined(__GNUC__)
  235. # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  236. # define CYTHON_UNUSED __attribute__ ((__unused__))
  237. # else
  238. # define CYTHON_UNUSED
  239. # endif
  240. # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
  241. # define CYTHON_UNUSED __attribute__ ((__unused__))
  242. # else
  243. # define CYTHON_UNUSED
  244. # endif
  245. #endif
  246. #ifndef CYTHON_MAYBE_UNUSED_VAR
  247. # if defined(__cplusplus)
  248. template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
  249. # else
  250. # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
  251. # endif
  252. #endif
  253. #ifndef CYTHON_NCP_UNUSED
  254. # if CYTHON_COMPILING_IN_CPYTHON
  255. # define CYTHON_NCP_UNUSED
  256. # else
  257. # define CYTHON_NCP_UNUSED CYTHON_UNUSED
  258. # endif
  259. #endif
  260. #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
  261. #ifdef _MSC_VER
  262. #ifndef _MSC_STDINT_H_
  263. #if _MSC_VER < 1300
  264. typedef unsigned char uint8_t;
  265. typedef unsigned int uint32_t;
  266. #else
  267. typedef unsigned __int8 uint8_t;
  268. typedef unsigned __int32 uint32_t;
  269. #endif
  270. #endif
  271. #else
  272. #include <stdint.h>
  273. #endif
  274. #ifndef CYTHON_FALLTHROUGH
  275. #if defined(__cplusplus) && __cplusplus >= 201103L
  276. #if __has_cpp_attribute(fallthrough)
  277. #define CYTHON_FALLTHROUGH [[fallthrough]]
  278. #elif __has_cpp_attribute(clang::fallthrough)
  279. #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
  280. #elif __has_cpp_attribute(gnu::fallthrough)
  281. #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
  282. #endif
  283. #endif
  284. #ifndef CYTHON_FALLTHROUGH
  285. #if __has_attribute(fallthrough)
  286. #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
  287. #else
  288. #define CYTHON_FALLTHROUGH
  289. #endif
  290. #endif
  291. #if defined(__clang__ ) && defined(__apple_build_version__)
  292. #if __apple_build_version__ < 7000000
  293. #undef CYTHON_FALLTHROUGH
  294. #define CYTHON_FALLTHROUGH
  295. #endif
  296. #endif
  297. #endif
  298. #ifndef __cplusplus
  299. #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
  300. #endif
  301. #ifndef CYTHON_INLINE
  302. #if defined(__clang__)
  303. #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  304. #else
  305. #define CYTHON_INLINE inline
  306. #endif
  307. #endif
  308. template<typename T>
  309. void __Pyx_call_destructor(T& x) {
  310. x.~T();
  311. }
  312. template<typename T>
  313. class __Pyx_FakeReference {
  314. public:
  315. __Pyx_FakeReference() : ptr(NULL) { }
  316. __Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
  317. T *operator->() { return ptr; }
  318. T *operator&() { return ptr; }
  319. operator T&() { return *ptr; }
  320. template<typename U> bool operator ==(U other) { return *ptr == other; }
  321. template<typename U> bool operator !=(U other) { return *ptr != other; }
  322. private:
  323. T *ptr;
  324. };
  325. #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  326. #define Py_OptimizeFlag 0
  327. #endif
  328. #define __PYX_BUILD_PY_SSIZE_T "n"
  329. #define CYTHON_FORMAT_SSIZE_T "z"
  330. #if PY_MAJOR_VERSION < 3
  331. #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  332. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  333. PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  334. #define __Pyx_DefaultClassType PyClass_Type
  335. #else
  336. #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  337. #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  338. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  339. PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  340. #else
  341. #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
  342. PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  343. #endif
  344. #define __Pyx_DefaultClassType PyType_Type
  345. #endif
  346. #ifndef Py_TPFLAGS_CHECKTYPES
  347. #define Py_TPFLAGS_CHECKTYPES 0
  348. #endif
  349. #ifndef Py_TPFLAGS_HAVE_INDEX
  350. #define Py_TPFLAGS_HAVE_INDEX 0
  351. #endif
  352. #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  353. #define Py_TPFLAGS_HAVE_NEWBUFFER 0
  354. #endif
  355. #ifndef Py_TPFLAGS_HAVE_FINALIZE
  356. #define Py_TPFLAGS_HAVE_FINALIZE 0
  357. #endif
  358. #ifndef METH_STACKLESS
  359. #define METH_STACKLESS 0
  360. #endif
  361. #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  362. #ifndef METH_FASTCALL
  363. #define METH_FASTCALL 0x80
  364. #endif
  365. typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  366. typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
  367. Py_ssize_t nargs, PyObject *kwnames);
  368. #else
  369. #define __Pyx_PyCFunctionFast _PyCFunctionFast
  370. #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
  371. #endif
  372. #if CYTHON_FAST_PYCCALL
  373. #define __Pyx_PyFastCFunction_Check(func)\
  374. ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
  375. #else
  376. #define __Pyx_PyFastCFunction_Check(func) 0
  377. #endif
  378. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  379. #define PyObject_Malloc(s) PyMem_Malloc(s)
  380. #define PyObject_Free(p) PyMem_Free(p)
  381. #define PyObject_Realloc(p) PyMem_Realloc(p)
  382. #endif
  383. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  384. #define PyMem_RawMalloc(n) PyMem_Malloc(n)
  385. #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
  386. #define PyMem_RawFree(p) PyMem_Free(p)
  387. #endif
  388. #if CYTHON_COMPILING_IN_PYSTON
  389. #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
  390. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
  391. #else
  392. #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
  393. #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
  394. #endif
  395. #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  396. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  397. #elif PY_VERSION_HEX >= 0x03060000
  398. #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
  399. #elif PY_VERSION_HEX >= 0x03000000
  400. #define __Pyx_PyThreadState_Current PyThreadState_GET()
  401. #else
  402. #define __Pyx_PyThreadState_Current _PyThreadState_Current
  403. #endif
  404. #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
  405. #include "pythread.h"
  406. #define Py_tss_NEEDS_INIT 0
  407. typedef int Py_tss_t;
  408. static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  409. *key = PyThread_create_key();
  410. return 0;
  411. }
  412. static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  413. Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  414. *key = Py_tss_NEEDS_INIT;
  415. return key;
  416. }
  417. static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  418. PyObject_Free(key);
  419. }
  420. static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  421. return *key != Py_tss_NEEDS_INIT;
  422. }
  423. static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  424. PyThread_delete_key(*key);
  425. *key = Py_tss_NEEDS_INIT;
  426. }
  427. static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  428. return PyThread_set_key_value(*key, value);
  429. }
  430. static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  431. return PyThread_get_key_value(*key);
  432. }
  433. #endif
  434. #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
  435. #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
  436. #else
  437. #define __Pyx_PyDict_NewPresized(n) PyDict_New()
  438. #endif
  439. #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  440. #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
  441. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
  442. #else
  443. #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
  444. #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
  445. #endif
  446. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
  447. #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
  448. #else
  449. #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
  450. #endif
  451. #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  452. #define CYTHON_PEP393_ENABLED 1
  453. #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
  454. 0 : _PyUnicode_Ready((PyObject *)(op)))
  455. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  456. #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  457. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
  458. #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
  459. #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
  460. #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
  461. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
  462. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
  463. #else
  464. #define CYTHON_PEP393_ENABLED 0
  465. #define PyUnicode_1BYTE_KIND 1
  466. #define PyUnicode_2BYTE_KIND 2
  467. #define PyUnicode_4BYTE_KIND 4
  468. #define __Pyx_PyUnicode_READY(op) (0)
  469. #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  470. #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  471. #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  472. #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
  473. #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
  474. #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  475. #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  476. #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
  477. #endif
  478. #if CYTHON_COMPILING_IN_PYPY
  479. #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
  480. #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
  481. #else
  482. #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
  483. #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
  484. PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  485. #endif
  486. #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  487. #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
  488. #endif
  489. #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  490. #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
  491. #endif
  492. #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  493. #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
  494. #endif
  495. #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))
  496. #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
  497. #if PY_MAJOR_VERSION >= 3
  498. #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
  499. #else
  500. #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
  501. #endif
  502. #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  503. #define PyObject_ASCII(o) PyObject_Repr(o)
  504. #endif
  505. #if PY_MAJOR_VERSION >= 3
  506. #define PyBaseString_Type PyUnicode_Type
  507. #define PyStringObject PyUnicodeObject
  508. #define PyString_Type PyUnicode_Type
  509. #define PyString_Check PyUnicode_Check
  510. #define PyString_CheckExact PyUnicode_CheckExact
  511. #define PyObject_Unicode PyObject_Str
  512. #endif
  513. #if PY_MAJOR_VERSION >= 3
  514. #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  515. #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
  516. #else
  517. #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  518. #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
  519. #endif
  520. #ifndef PySet_CheckExact
  521. #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
  522. #endif
  523. #if CYTHON_ASSUME_SAFE_MACROS
  524. #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
  525. #else
  526. #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
  527. #endif
  528. #if PY_MAJOR_VERSION >= 3
  529. #define PyIntObject PyLongObject
  530. #define PyInt_Type PyLong_Type
  531. #define PyInt_Check(op) PyLong_Check(op)
  532. #define PyInt_CheckExact(op) PyLong_CheckExact(op)
  533. #define PyInt_FromString PyLong_FromString
  534. #define PyInt_FromUnicode PyLong_FromUnicode
  535. #define PyInt_FromLong PyLong_FromLong
  536. #define PyInt_FromSize_t PyLong_FromSize_t
  537. #define PyInt_FromSsize_t PyLong_FromSsize_t
  538. #define PyInt_AsLong PyLong_AsLong
  539. #define PyInt_AS_LONG PyLong_AS_LONG
  540. #define PyInt_AsSsize_t PyLong_AsSsize_t
  541. #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
  542. #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  543. #define PyNumber_Int PyNumber_Long
  544. #endif
  545. #if PY_MAJOR_VERSION >= 3
  546. #define PyBoolObject PyLongObject
  547. #endif
  548. #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  549. #ifndef PyUnicode_InternFromString
  550. #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  551. #endif
  552. #endif
  553. #if PY_VERSION_HEX < 0x030200A4
  554. typedef long Py_hash_t;
  555. #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  556. #define __Pyx_PyInt_AsHash_t PyInt_AsLong
  557. #else
  558. #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  559. #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
  560. #endif
  561. #if PY_MAJOR_VERSION >= 3
  562. #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
  563. #else
  564. #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
  565. #endif
  566. #if CYTHON_USE_ASYNC_SLOTS
  567. #if PY_VERSION_HEX >= 0x030500B1
  568. #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
  569. #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  570. #else
  571. #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  572. #endif
  573. #else
  574. #define __Pyx_PyType_AsAsync(obj) NULL
  575. #endif
  576. #ifndef __Pyx_PyAsyncMethodsStruct
  577. typedef struct {
  578. unaryfunc am_await;
  579. unaryfunc am_aiter;
  580. unaryfunc am_anext;
  581. } __Pyx_PyAsyncMethodsStruct;
  582. #endif
  583. #if defined(WIN32) || defined(MS_WINDOWS)
  584. #define _USE_MATH_DEFINES
  585. #endif
  586. #include <math.h>
  587. #ifdef NAN
  588. #define __PYX_NAN() ((float) NAN)
  589. #else
  590. static CYTHON_INLINE float __PYX_NAN() {
  591. float value;
  592. memset(&value, 0xFF, sizeof(value));
  593. return value;
  594. }
  595. #endif
  596. #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
  597. #define __Pyx_truncl trunc
  598. #else
  599. #define __Pyx_truncl truncl
  600. #endif
  601. #define __PYX_ERR(f_index, lineno, Ln_error) \
  602. { \
  603. __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
  604. }
  605. #ifndef __PYX_EXTERN_C
  606. #ifdef __cplusplus
  607. #define __PYX_EXTERN_C extern "C"
  608. #else
  609. #define __PYX_EXTERN_C extern
  610. #endif
  611. #endif
  612. #define __PYX_HAVE__app__trade__trade_utils
  613. #define __PYX_HAVE_API__app__trade__trade_utils
  614. /* Early includes */
  615. #include <string.h>
  616. #include <stdio.h>
  617. #include "numpy/arrayobject.h"
  618. #include "numpy/ufuncobject.h"
  619. #include "ios"
  620. #include "new"
  621. #include "stdexcept"
  622. #include "typeinfo"
  623. #include <queue>
  624. #include <utility>
  625. #include "pythread.h"
  626. #include <stdlib.h>
  627. #include "pystate.h"
  628. #ifdef _OPENMP
  629. #include <omp.h>
  630. #endif /* _OPENMP */
  631. #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
  632. #define CYTHON_WITHOUT_ASSERTIONS
  633. #endif
  634. typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
  635. const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
  636. #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
  637. #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
  638. #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
  639. #define __PYX_DEFAULT_STRING_ENCODING ""
  640. #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
  641. #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  642. #define __Pyx_uchar_cast(c) ((unsigned char)c)
  643. #define __Pyx_long_cast(x) ((long)x)
  644. #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
  645. (sizeof(type) < sizeof(Py_ssize_t)) ||\
  646. (sizeof(type) > sizeof(Py_ssize_t) &&\
  647. likely(v < (type)PY_SSIZE_T_MAX ||\
  648. v == (type)PY_SSIZE_T_MAX) &&\
  649. (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
  650. v == (type)PY_SSIZE_T_MIN))) ||\
  651. (sizeof(type) == sizeof(Py_ssize_t) &&\
  652. (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
  653. v == (type)PY_SSIZE_T_MAX))) )
  654. static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
  655. return (size_t) i < (size_t) limit;
  656. }
  657. #if defined (__cplusplus) && __cplusplus >= 201103L
  658. #include <cstdlib>
  659. #define __Pyx_sst_abs(value) std::abs(value)
  660. #elif SIZEOF_INT >= SIZEOF_SIZE_T
  661. #define __Pyx_sst_abs(value) abs(value)
  662. #elif SIZEOF_LONG >= SIZEOF_SIZE_T
  663. #define __Pyx_sst_abs(value) labs(value)
  664. #elif defined (_MSC_VER)
  665. #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
  666. #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  667. #define __Pyx_sst_abs(value) llabs(value)
  668. #elif defined (__GNUC__)
  669. #define __Pyx_sst_abs(value) __builtin_llabs(value)
  670. #else
  671. #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
  672. #endif
  673. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
  674. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
  675. #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
  676. #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
  677. #define __Pyx_PyBytes_FromString PyBytes_FromString
  678. #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
  679. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
  680. #if PY_MAJOR_VERSION < 3
  681. #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
  682. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
  683. #else
  684. #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
  685. #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
  686. #endif
  687. #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
  688. #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
  689. #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
  690. #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
  691. #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
  692. #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
  693. #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
  694. #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
  695. #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
  696. #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
  697. #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
  698. #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
  699. #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
  700. #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
  701. #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
  702. #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
  703. static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
  704. const Py_UNICODE *u_end = u;
  705. while (*u_end++) ;
  706. return (size_t)(u_end - u - 1);
  707. }
  708. #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
  709. #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
  710. #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
  711. #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
  712. #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
  713. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
  714. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
  715. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
  716. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
  717. #define __Pyx_PySequence_Tuple(obj)\
  718. (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
  719. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
  720. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
  721. #if CYTHON_ASSUME_SAFE_MACROS
  722. #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
  723. #else
  724. #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
  725. #endif
  726. #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
  727. #if PY_MAJOR_VERSION >= 3
  728. #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
  729. #else
  730. #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
  731. #endif
  732. #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
  733. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  734. static int __Pyx_sys_getdefaultencoding_not_ascii;
  735. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  736. PyObject* sys;
  737. PyObject* default_encoding = NULL;
  738. PyObject* ascii_chars_u = NULL;
  739. PyObject* ascii_chars_b = NULL;
  740. const char* default_encoding_c;
  741. sys = PyImport_ImportModule("sys");
  742. if (!sys) goto bad;
  743. default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
  744. Py_DECREF(sys);
  745. if (!default_encoding) goto bad;
  746. default_encoding_c = PyBytes_AsString(default_encoding);
  747. if (!default_encoding_c) goto bad;
  748. if (strcmp(default_encoding_c, "ascii") == 0) {
  749. __Pyx_sys_getdefaultencoding_not_ascii = 0;
  750. } else {
  751. char ascii_chars[128];
  752. int c;
  753. for (c = 0; c < 128; c++) {
  754. ascii_chars[c] = c;
  755. }
  756. __Pyx_sys_getdefaultencoding_not_ascii = 1;
  757. ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
  758. if (!ascii_chars_u) goto bad;
  759. ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
  760. if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
  761. PyErr_Format(
  762. PyExc_ValueError,
  763. "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
  764. default_encoding_c);
  765. goto bad;
  766. }
  767. Py_DECREF(ascii_chars_u);
  768. Py_DECREF(ascii_chars_b);
  769. }
  770. Py_DECREF(default_encoding);
  771. return 0;
  772. bad:
  773. Py_XDECREF(default_encoding);
  774. Py_XDECREF(ascii_chars_u);
  775. Py_XDECREF(ascii_chars_b);
  776. return -1;
  777. }
  778. #endif
  779. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
  780. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
  781. #else
  782. #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
  783. #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  784. static char* __PYX_DEFAULT_STRING_ENCODING;
  785. static int __Pyx_init_sys_getdefaultencoding_params(void) {
  786. PyObject* sys;
  787. PyObject* default_encoding = NULL;
  788. char* default_encoding_c;
  789. sys = PyImport_ImportModule("sys");
  790. if (!sys) goto bad;
  791. default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
  792. Py_DECREF(sys);
  793. if (!default_encoding) goto bad;
  794. default_encoding_c = PyBytes_AsString(default_encoding);
  795. if (!default_encoding_c) goto bad;
  796. __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
  797. if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
  798. strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
  799. Py_DECREF(default_encoding);
  800. return 0;
  801. bad:
  802. Py_XDECREF(default_encoding);
  803. return -1;
  804. }
  805. #endif
  806. #endif
  807. /* Test for GCC > 2.95 */
  808. #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  809. #define likely(x) __builtin_expect(!!(x), 1)
  810. #define unlikely(x) __builtin_expect(!!(x), 0)
  811. #else /* !__GNUC__ or GCC < 2.95 */
  812. #define likely(x) (x)
  813. #define unlikely(x) (x)
  814. #endif /* __GNUC__ */
  815. static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
  816. static PyObject *__pyx_m = NULL;
  817. static PyObject *__pyx_d;
  818. static PyObject *__pyx_b;
  819. static PyObject *__pyx_cython_runtime = NULL;
  820. static PyObject *__pyx_empty_tuple;
  821. static PyObject *__pyx_empty_bytes;
  822. static PyObject *__pyx_empty_unicode;
  823. static int __pyx_lineno;
  824. static int __pyx_clineno = 0;
  825. static const char * __pyx_cfilenm= __FILE__;
  826. static const char *__pyx_filename;
  827. /* Header.proto */
  828. #if !defined(CYTHON_CCOMPLEX)
  829. #if defined(__cplusplus)
  830. #define CYTHON_CCOMPLEX 1
  831. #elif defined(_Complex_I)
  832. #define CYTHON_CCOMPLEX 1
  833. #else
  834. #define CYTHON_CCOMPLEX 0
  835. #endif
  836. #endif
  837. #if CYTHON_CCOMPLEX
  838. #ifdef __cplusplus
  839. #include <complex>
  840. #else
  841. #include <complex.h>
  842. #endif
  843. #endif
  844. #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  845. #undef _Complex_I
  846. #define _Complex_I 1.0fj
  847. #endif
  848. static const char *__pyx_f[] = {
  849. "app/trade/trade_utils.pyx",
  850. "__init__.pxd",
  851. "stringsource",
  852. "type.pxd",
  853. };
  854. /* MemviewSliceStruct.proto */
  855. struct __pyx_memoryview_obj;
  856. typedef struct {
  857. struct __pyx_memoryview_obj *memview;
  858. char *data;
  859. Py_ssize_t shape[8];
  860. Py_ssize_t strides[8];
  861. Py_ssize_t suboffsets[8];
  862. } __Pyx_memviewslice;
  863. #define __Pyx_MemoryView_Len(m) (m.shape[0])
  864. /* Atomics.proto */
  865. #include <pythread.h>
  866. #ifndef CYTHON_ATOMICS
  867. #define CYTHON_ATOMICS 1
  868. #endif
  869. #define __pyx_atomic_int_type int
  870. #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
  871. (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
  872. !defined(__i386__)
  873. #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
  874. #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
  875. #ifdef __PYX_DEBUG_ATOMICS
  876. #warning "Using GNU atomics"
  877. #endif
  878. #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
  879. #include <Windows.h>
  880. #undef __pyx_atomic_int_type
  881. #define __pyx_atomic_int_type LONG
  882. #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
  883. #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
  884. #ifdef __PYX_DEBUG_ATOMICS
  885. #pragma message ("Using MSVC atomics")
  886. #endif
  887. #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
  888. #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
  889. #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
  890. #ifdef __PYX_DEBUG_ATOMICS
  891. #warning "Using Intel atomics"
  892. #endif
  893. #else
  894. #undef CYTHON_ATOMICS
  895. #define CYTHON_ATOMICS 0
  896. #ifdef __PYX_DEBUG_ATOMICS
  897. #warning "Not using atomics"
  898. #endif
  899. #endif
  900. typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
  901. #if CYTHON_ATOMICS
  902. #define __pyx_add_acquisition_count(memview)\
  903. __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
  904. #define __pyx_sub_acquisition_count(memview)\
  905. __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
  906. #else
  907. #define __pyx_add_acquisition_count(memview)\
  908. __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
  909. #define __pyx_sub_acquisition_count(memview)\
  910. __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
  911. #endif
  912. /* ForceInitThreads.proto */
  913. #ifndef __PYX_FORCE_INIT_THREADS
  914. #define __PYX_FORCE_INIT_THREADS 0
  915. #endif
  916. /* NoFastGil.proto */
  917. #define __Pyx_PyGILState_Ensure PyGILState_Ensure
  918. #define __Pyx_PyGILState_Release PyGILState_Release
  919. #define __Pyx_FastGIL_Remember()
  920. #define __Pyx_FastGIL_Forget()
  921. #define __Pyx_FastGilFuncInit()
  922. /* BufferFormatStructs.proto */
  923. #define IS_UNSIGNED(type) (((type) -1) > 0)
  924. struct __Pyx_StructField_;
  925. #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
  926. typedef struct {
  927. const char* name;
  928. struct __Pyx_StructField_* fields;
  929. size_t size;
  930. size_t arraysize[8];
  931. int ndim;
  932. char typegroup;
  933. char is_unsigned;
  934. int flags;
  935. } __Pyx_TypeInfo;
  936. typedef struct __Pyx_StructField_ {
  937. __Pyx_TypeInfo* type;
  938. const char* name;
  939. size_t offset;
  940. } __Pyx_StructField;
  941. typedef struct {
  942. __Pyx_StructField* field;
  943. size_t parent_offset;
  944. } __Pyx_BufFmt_StackElem;
  945. typedef struct {
  946. __Pyx_StructField root;
  947. __Pyx_BufFmt_StackElem* head;
  948. size_t fmt_offset;
  949. size_t new_count, enc_count;
  950. size_t struct_alignment;
  951. int is_complex;
  952. char enc_type;
  953. char new_packmode;
  954. char enc_packmode;
  955. char is_valid_array;
  956. } __Pyx_BufFmt_Context;
  957. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":776
  958. * # in Cython to enable them only on the right systems.
  959. *
  960. * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
  961. * ctypedef npy_int16 int16_t
  962. * ctypedef npy_int32 int32_t
  963. */
  964. typedef npy_int8 __pyx_t_5numpy_int8_t;
  965. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":777
  966. *
  967. * ctypedef npy_int8 int8_t
  968. * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
  969. * ctypedef npy_int32 int32_t
  970. * ctypedef npy_int64 int64_t
  971. */
  972. typedef npy_int16 __pyx_t_5numpy_int16_t;
  973. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":778
  974. * ctypedef npy_int8 int8_t
  975. * ctypedef npy_int16 int16_t
  976. * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
  977. * ctypedef npy_int64 int64_t
  978. * #ctypedef npy_int96 int96_t
  979. */
  980. typedef npy_int32 __pyx_t_5numpy_int32_t;
  981. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":779
  982. * ctypedef npy_int16 int16_t
  983. * ctypedef npy_int32 int32_t
  984. * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
  985. * #ctypedef npy_int96 int96_t
  986. * #ctypedef npy_int128 int128_t
  987. */
  988. typedef npy_int64 __pyx_t_5numpy_int64_t;
  989. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":783
  990. * #ctypedef npy_int128 int128_t
  991. *
  992. * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
  993. * ctypedef npy_uint16 uint16_t
  994. * ctypedef npy_uint32 uint32_t
  995. */
  996. typedef npy_uint8 __pyx_t_5numpy_uint8_t;
  997. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":784
  998. *
  999. * ctypedef npy_uint8 uint8_t
  1000. * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
  1001. * ctypedef npy_uint32 uint32_t
  1002. * ctypedef npy_uint64 uint64_t
  1003. */
  1004. typedef npy_uint16 __pyx_t_5numpy_uint16_t;
  1005. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":785
  1006. * ctypedef npy_uint8 uint8_t
  1007. * ctypedef npy_uint16 uint16_t
  1008. * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
  1009. * ctypedef npy_uint64 uint64_t
  1010. * #ctypedef npy_uint96 uint96_t
  1011. */
  1012. typedef npy_uint32 __pyx_t_5numpy_uint32_t;
  1013. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":786
  1014. * ctypedef npy_uint16 uint16_t
  1015. * ctypedef npy_uint32 uint32_t
  1016. * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
  1017. * #ctypedef npy_uint96 uint96_t
  1018. * #ctypedef npy_uint128 uint128_t
  1019. */
  1020. typedef npy_uint64 __pyx_t_5numpy_uint64_t;
  1021. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":790
  1022. * #ctypedef npy_uint128 uint128_t
  1023. *
  1024. * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
  1025. * ctypedef npy_float64 float64_t
  1026. * #ctypedef npy_float80 float80_t
  1027. */
  1028. typedef npy_float32 __pyx_t_5numpy_float32_t;
  1029. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":791
  1030. *
  1031. * ctypedef npy_float32 float32_t
  1032. * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
  1033. * #ctypedef npy_float80 float80_t
  1034. * #ctypedef npy_float128 float128_t
  1035. */
  1036. typedef npy_float64 __pyx_t_5numpy_float64_t;
  1037. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":800
  1038. * # The int types are mapped a bit surprising --
  1039. * # numpy.int corresponds to 'l' and numpy.long to 'q'
  1040. * ctypedef npy_long int_t # <<<<<<<<<<<<<<
  1041. * ctypedef npy_longlong long_t
  1042. * ctypedef npy_longlong longlong_t
  1043. */
  1044. typedef npy_long __pyx_t_5numpy_int_t;
  1045. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":801
  1046. * # numpy.int corresponds to 'l' and numpy.long to 'q'
  1047. * ctypedef npy_long int_t
  1048. * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
  1049. * ctypedef npy_longlong longlong_t
  1050. *
  1051. */
  1052. typedef npy_longlong __pyx_t_5numpy_long_t;
  1053. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":802
  1054. * ctypedef npy_long int_t
  1055. * ctypedef npy_longlong long_t
  1056. * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
  1057. *
  1058. * ctypedef npy_ulong uint_t
  1059. */
  1060. typedef npy_longlong __pyx_t_5numpy_longlong_t;
  1061. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":804
  1062. * ctypedef npy_longlong longlong_t
  1063. *
  1064. * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
  1065. * ctypedef npy_ulonglong ulong_t
  1066. * ctypedef npy_ulonglong ulonglong_t
  1067. */
  1068. typedef npy_ulong __pyx_t_5numpy_uint_t;
  1069. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":805
  1070. *
  1071. * ctypedef npy_ulong uint_t
  1072. * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
  1073. * ctypedef npy_ulonglong ulonglong_t
  1074. *
  1075. */
  1076. typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
  1077. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":806
  1078. * ctypedef npy_ulong uint_t
  1079. * ctypedef npy_ulonglong ulong_t
  1080. * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
  1081. *
  1082. * ctypedef npy_intp intp_t
  1083. */
  1084. typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
  1085. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":808
  1086. * ctypedef npy_ulonglong ulonglong_t
  1087. *
  1088. * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
  1089. * ctypedef npy_uintp uintp_t
  1090. *
  1091. */
  1092. typedef npy_intp __pyx_t_5numpy_intp_t;
  1093. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":809
  1094. *
  1095. * ctypedef npy_intp intp_t
  1096. * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
  1097. *
  1098. * ctypedef npy_double float_t
  1099. */
  1100. typedef npy_uintp __pyx_t_5numpy_uintp_t;
  1101. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":811
  1102. * ctypedef npy_uintp uintp_t
  1103. *
  1104. * ctypedef npy_double float_t # <<<<<<<<<<<<<<
  1105. * ctypedef npy_double double_t
  1106. * ctypedef npy_longdouble longdouble_t
  1107. */
  1108. typedef npy_double __pyx_t_5numpy_float_t;
  1109. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":812
  1110. *
  1111. * ctypedef npy_double float_t
  1112. * ctypedef npy_double double_t # <<<<<<<<<<<<<<
  1113. * ctypedef npy_longdouble longdouble_t
  1114. *
  1115. */
  1116. typedef npy_double __pyx_t_5numpy_double_t;
  1117. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":813
  1118. * ctypedef npy_double float_t
  1119. * ctypedef npy_double double_t
  1120. * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
  1121. *
  1122. * ctypedef npy_cfloat cfloat_t
  1123. */
  1124. typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
  1125. /* Declarations.proto */
  1126. #if CYTHON_CCOMPLEX
  1127. #ifdef __cplusplus
  1128. typedef ::std::complex< float > __pyx_t_float_complex;
  1129. #else
  1130. typedef float _Complex __pyx_t_float_complex;
  1131. #endif
  1132. #else
  1133. typedef struct { float real, imag; } __pyx_t_float_complex;
  1134. #endif
  1135. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
  1136. /* Declarations.proto */
  1137. #if CYTHON_CCOMPLEX
  1138. #ifdef __cplusplus
  1139. typedef ::std::complex< double > __pyx_t_double_complex;
  1140. #else
  1141. typedef double _Complex __pyx_t_double_complex;
  1142. #endif
  1143. #else
  1144. typedef struct { double real, imag; } __pyx_t_double_complex;
  1145. #endif
  1146. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
  1147. /*--- Type declarations ---*/
  1148. struct __pyx_array_obj;
  1149. struct __pyx_MemviewEnum_obj;
  1150. struct __pyx_memoryview_obj;
  1151. struct __pyx_memoryviewslice_obj;
  1152. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":815
  1153. * ctypedef npy_longdouble longdouble_t
  1154. *
  1155. * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
  1156. * ctypedef npy_cdouble cdouble_t
  1157. * ctypedef npy_clongdouble clongdouble_t
  1158. */
  1159. typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
  1160. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":816
  1161. *
  1162. * ctypedef npy_cfloat cfloat_t
  1163. * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
  1164. * ctypedef npy_clongdouble clongdouble_t
  1165. *
  1166. */
  1167. typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
  1168. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":817
  1169. * ctypedef npy_cfloat cfloat_t
  1170. * ctypedef npy_cdouble cdouble_t
  1171. * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
  1172. *
  1173. * ctypedef npy_cdouble complex_t
  1174. */
  1175. typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
  1176. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":819
  1177. * ctypedef npy_clongdouble clongdouble_t
  1178. *
  1179. * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
  1180. *
  1181. * cdef inline object PyArray_MultiIterNew1(a):
  1182. */
  1183. typedef npy_cdouble __pyx_t_5numpy_complex_t;
  1184. /* "app/trade/trade_utils.pyx":9
  1185. * from libcpp.pair cimport pair
  1186. *
  1187. * ctypedef pair[float, int] step # <<<<<<<<<<<<<<
  1188. * ctypedef priority_queue[step] pp_t
  1189. *
  1190. */
  1191. typedef std::pair<float,int> __pyx_t_3app_5trade_11trade_utils_step;
  1192. /* "app/trade/trade_utils.pyx":10
  1193. *
  1194. * ctypedef pair[float, int] step
  1195. * ctypedef priority_queue[step] pp_t # <<<<<<<<<<<<<<
  1196. *
  1197. *
  1198. */
  1199. typedef std::priority_queue<__pyx_t_3app_5trade_11trade_utils_step> __pyx_t_3app_5trade_11trade_utils_pp_t;
  1200. /* "View.MemoryView":105
  1201. *
  1202. * @cname("__pyx_array")
  1203. * cdef class array: # <<<<<<<<<<<<<<
  1204. *
  1205. * cdef:
  1206. */
  1207. struct __pyx_array_obj {
  1208. PyObject_HEAD
  1209. struct __pyx_vtabstruct_array *__pyx_vtab;
  1210. char *data;
  1211. Py_ssize_t len;
  1212. char *format;
  1213. int ndim;
  1214. Py_ssize_t *_shape;
  1215. Py_ssize_t *_strides;
  1216. Py_ssize_t itemsize;
  1217. PyObject *mode;
  1218. PyObject *_format;
  1219. void (*callback_free_data)(void *);
  1220. int free_data;
  1221. int dtype_is_object;
  1222. };
  1223. /* "View.MemoryView":279
  1224. *
  1225. * @cname('__pyx_MemviewEnum')
  1226. * cdef class Enum(object): # <<<<<<<<<<<<<<
  1227. * cdef object name
  1228. * def __init__(self, name):
  1229. */
  1230. struct __pyx_MemviewEnum_obj {
  1231. PyObject_HEAD
  1232. PyObject *name;
  1233. };
  1234. /* "View.MemoryView":330
  1235. *
  1236. * @cname('__pyx_memoryview')
  1237. * cdef class memoryview(object): # <<<<<<<<<<<<<<
  1238. *
  1239. * cdef object obj
  1240. */
  1241. struct __pyx_memoryview_obj {
  1242. PyObject_HEAD
  1243. struct __pyx_vtabstruct_memoryview *__pyx_vtab;
  1244. PyObject *obj;
  1245. PyObject *_size;
  1246. PyObject *_array_interface;
  1247. PyThread_type_lock lock;
  1248. __pyx_atomic_int acquisition_count[2];
  1249. __pyx_atomic_int *acquisition_count_aligned_p;
  1250. Py_buffer view;
  1251. int flags;
  1252. int dtype_is_object;
  1253. __Pyx_TypeInfo *typeinfo;
  1254. };
  1255. /* "View.MemoryView":965
  1256. *
  1257. * @cname('__pyx_memoryviewslice')
  1258. * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
  1259. * "Internal class for passing memoryview slices to Python"
  1260. *
  1261. */
  1262. struct __pyx_memoryviewslice_obj {
  1263. struct __pyx_memoryview_obj __pyx_base;
  1264. __Pyx_memviewslice from_slice;
  1265. PyObject *from_object;
  1266. PyObject *(*to_object_func)(char *);
  1267. int (*to_dtype_func)(char *, PyObject *);
  1268. };
  1269. /* "View.MemoryView":105
  1270. *
  1271. * @cname("__pyx_array")
  1272. * cdef class array: # <<<<<<<<<<<<<<
  1273. *
  1274. * cdef:
  1275. */
  1276. struct __pyx_vtabstruct_array {
  1277. PyObject *(*get_memview)(struct __pyx_array_obj *);
  1278. };
  1279. static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
  1280. /* "View.MemoryView":330
  1281. *
  1282. * @cname('__pyx_memoryview')
  1283. * cdef class memoryview(object): # <<<<<<<<<<<<<<
  1284. *
  1285. * cdef object obj
  1286. */
  1287. struct __pyx_vtabstruct_memoryview {
  1288. char *(*get_item_pointer)(struct __pyx_memoryview_obj *, PyObject *);
  1289. PyObject *(*is_slice)(struct __pyx_memoryview_obj *, PyObject *);
  1290. PyObject *(*setitem_slice_assignment)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  1291. PyObject *(*setitem_slice_assign_scalar)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *);
  1292. PyObject *(*setitem_indexed)(struct __pyx_memoryview_obj *, PyObject *, PyObject *);
  1293. PyObject *(*convert_item_to_object)(struct __pyx_memoryview_obj *, char *);
  1294. PyObject *(*assign_item_from_object)(struct __pyx_memoryview_obj *, char *, PyObject *);
  1295. };
  1296. static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
  1297. /* "View.MemoryView":965
  1298. *
  1299. * @cname('__pyx_memoryviewslice')
  1300. * cdef class _memoryviewslice(memoryview): # <<<<<<<<<<<<<<
  1301. * "Internal class for passing memoryview slices to Python"
  1302. *
  1303. */
  1304. struct __pyx_vtabstruct__memoryviewslice {
  1305. struct __pyx_vtabstruct_memoryview __pyx_base;
  1306. };
  1307. static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
  1308. /* --- Runtime support code (head) --- */
  1309. /* Refnanny.proto */
  1310. #ifndef CYTHON_REFNANNY
  1311. #define CYTHON_REFNANNY 0
  1312. #endif
  1313. #if CYTHON_REFNANNY
  1314. typedef struct {
  1315. void (*INCREF)(void*, PyObject*, int);
  1316. void (*DECREF)(void*, PyObject*, int);
  1317. void (*GOTREF)(void*, PyObject*, int);
  1318. void (*GIVEREF)(void*, PyObject*, int);
  1319. void* (*SetupContext)(const char*, int, const char*);
  1320. void (*FinishContext)(void**);
  1321. } __Pyx_RefNannyAPIStruct;
  1322. static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  1323. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  1324. #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
  1325. #ifdef WITH_THREAD
  1326. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1327. if (acquire_gil) {\
  1328. PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
  1329. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1330. PyGILState_Release(__pyx_gilstate_save);\
  1331. } else {\
  1332. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
  1333. }
  1334. #else
  1335. #define __Pyx_RefNannySetupContext(name, acquire_gil)\
  1336. __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
  1337. #endif
  1338. #define __Pyx_RefNannyFinishContext()\
  1339. __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  1340. #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1341. #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1342. #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1343. #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  1344. #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  1345. #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  1346. #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  1347. #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
  1348. #else
  1349. #define __Pyx_RefNannyDeclarations
  1350. #define __Pyx_RefNannySetupContext(name, acquire_gil)
  1351. #define __Pyx_RefNannyFinishContext()
  1352. #define __Pyx_INCREF(r) Py_INCREF(r)
  1353. #define __Pyx_DECREF(r) Py_DECREF(r)
  1354. #define __Pyx_GOTREF(r)
  1355. #define __Pyx_GIVEREF(r)
  1356. #define __Pyx_XINCREF(r) Py_XINCREF(r)
  1357. #define __Pyx_XDECREF(r) Py_XDECREF(r)
  1358. #define __Pyx_XGOTREF(r)
  1359. #define __Pyx_XGIVEREF(r)
  1360. #endif
  1361. #define __Pyx_XDECREF_SET(r, v) do {\
  1362. PyObject *tmp = (PyObject *) r;\
  1363. r = v; __Pyx_XDECREF(tmp);\
  1364. } while (0)
  1365. #define __Pyx_DECREF_SET(r, v) do {\
  1366. PyObject *tmp = (PyObject *) r;\
  1367. r = v; __Pyx_DECREF(tmp);\
  1368. } while (0)
  1369. #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
  1370. #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
  1371. /* PyObjectGetAttrStr.proto */
  1372. #if CYTHON_USE_TYPE_SLOTS
  1373. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
  1374. #else
  1375. #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
  1376. #endif
  1377. /* GetBuiltinName.proto */
  1378. static PyObject *__Pyx_GetBuiltinName(PyObject *name);
  1379. /* None.proto */
  1380. static CYTHON_INLINE long __Pyx_mod_long(long, long);
  1381. /* PyDictVersioning.proto */
  1382. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  1383. #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
  1384. #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
  1385. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
  1386. (version_var) = __PYX_GET_DICT_VERSION(dict);\
  1387. (cache_var) = (value);
  1388. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
  1389. static PY_UINT64_T __pyx_dict_version = 0;\
  1390. static PyObject *__pyx_dict_cached_value = NULL;\
  1391. if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
  1392. (VAR) = __pyx_dict_cached_value;\
  1393. } else {\
  1394. (VAR) = __pyx_dict_cached_value = (LOOKUP);\
  1395. __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
  1396. }\
  1397. }
  1398. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
  1399. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
  1400. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
  1401. #else
  1402. #define __PYX_GET_DICT_VERSION(dict) (0)
  1403. #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
  1404. #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
  1405. #endif
  1406. /* GetModuleGlobalName.proto */
  1407. #if CYTHON_USE_DICT_VERSIONS
  1408. #define __Pyx_GetModuleGlobalName(var, name) {\
  1409. static PY_UINT64_T __pyx_dict_version = 0;\
  1410. static PyObject *__pyx_dict_cached_value = NULL;\
  1411. (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
  1412. (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
  1413. __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1414. }
  1415. #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
  1416. PY_UINT64_T __pyx_dict_version;\
  1417. PyObject *__pyx_dict_cached_value;\
  1418. (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
  1419. }
  1420. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
  1421. #else
  1422. #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1423. #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
  1424. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
  1425. #endif
  1426. /* PyObjectCall.proto */
  1427. #if CYTHON_COMPILING_IN_CPYTHON
  1428. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
  1429. #else
  1430. #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
  1431. #endif
  1432. /* BufferIndexError.proto */
  1433. static void __Pyx_RaiseBufferIndexError(int axis);
  1434. /* MemviewSliceInit.proto */
  1435. #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
  1436. #define __Pyx_MEMVIEW_DIRECT 1
  1437. #define __Pyx_MEMVIEW_PTR 2
  1438. #define __Pyx_MEMVIEW_FULL 4
  1439. #define __Pyx_MEMVIEW_CONTIG 8
  1440. #define __Pyx_MEMVIEW_STRIDED 16
  1441. #define __Pyx_MEMVIEW_FOLLOW 32
  1442. #define __Pyx_IS_C_CONTIG 1
  1443. #define __Pyx_IS_F_CONTIG 2
  1444. static int __Pyx_init_memviewslice(
  1445. struct __pyx_memoryview_obj *memview,
  1446. int ndim,
  1447. __Pyx_memviewslice *memviewslice,
  1448. int memview_is_new_reference);
  1449. static CYTHON_INLINE int __pyx_add_acquisition_count_locked(
  1450. __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
  1451. static CYTHON_INLINE int __pyx_sub_acquisition_count_locked(
  1452. __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
  1453. #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
  1454. #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
  1455. #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
  1456. #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
  1457. static CYTHON_INLINE void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *, int, int);
  1458. static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *, int, int);
  1459. /* RaiseArgTupleInvalid.proto */
  1460. static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
  1461. Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
  1462. /* RaiseDoubleKeywords.proto */
  1463. static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
  1464. /* ParseKeywords.proto */
  1465. static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
  1466. PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
  1467. const char* function_name);
  1468. /* ArgTypeTest.proto */
  1469. #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
  1470. ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
  1471. __Pyx__ArgTypeTest(obj, type, name, exact))
  1472. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);
  1473. /* PyFunctionFastCall.proto */
  1474. #if CYTHON_FAST_PYCALL
  1475. #define __Pyx_PyFunction_FastCall(func, args, nargs)\
  1476. __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
  1477. #if 1 || PY_VERSION_HEX < 0x030600B1
  1478. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
  1479. #else
  1480. #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
  1481. #endif
  1482. #define __Pyx_BUILD_ASSERT_EXPR(cond)\
  1483. (sizeof(char [1 - 2*!(cond)]) - 1)
  1484. #ifndef Py_MEMBER_SIZE
  1485. #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
  1486. #endif
  1487. static size_t __pyx_pyframe_localsplus_offset = 0;
  1488. #include "frameobject.h"
  1489. #define __Pxy_PyFrame_Initialize_Offsets()\
  1490. ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
  1491. (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  1492. #define __Pyx_PyFrame_GetLocalsplus(frame)\
  1493. (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
  1494. #endif
  1495. /* PyCFunctionFastCall.proto */
  1496. #if CYTHON_FAST_PYCCALL
  1497. static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
  1498. #else
  1499. #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
  1500. #endif
  1501. /* GetItemInt.proto */
  1502. #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1503. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1504. __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
  1505. (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
  1506. __Pyx_GetItemInt_Generic(o, to_py_func(i))))
  1507. #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1508. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1509. __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1510. (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
  1511. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  1512. int wraparound, int boundscheck);
  1513. #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
  1514. (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
  1515. __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
  1516. (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
  1517. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  1518. int wraparound, int boundscheck);
  1519. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
  1520. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
  1521. int is_list, int wraparound, int boundscheck);
  1522. /* ObjectGetItem.proto */
  1523. #if CYTHON_USE_TYPE_SLOTS
  1524. static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
  1525. #else
  1526. #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
  1527. #endif
  1528. /* RaiseTooManyValuesToUnpack.proto */
  1529. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
  1530. /* RaiseNeedMoreValuesToUnpack.proto */
  1531. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
  1532. /* IterFinish.proto */
  1533. static CYTHON_INLINE int __Pyx_IterFinish(void);
  1534. /* UnpackItemEndCheck.proto */
  1535. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
  1536. /* PyThreadStateGet.proto */
  1537. #if CYTHON_FAST_THREAD_STATE
  1538. #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
  1539. #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
  1540. #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
  1541. #else
  1542. #define __Pyx_PyThreadState_declare
  1543. #define __Pyx_PyThreadState_assign
  1544. #define __Pyx_PyErr_Occurred() PyErr_Occurred()
  1545. #endif
  1546. /* PyErrFetchRestore.proto */
  1547. #if CYTHON_FAST_THREAD_STATE
  1548. #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
  1549. #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
  1550. #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
  1551. #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
  1552. #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
  1553. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1554. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1555. #if CYTHON_COMPILING_IN_CPYTHON
  1556. #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
  1557. #else
  1558. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1559. #endif
  1560. #else
  1561. #define __Pyx_PyErr_Clear() PyErr_Clear()
  1562. #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
  1563. #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
  1564. #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
  1565. #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
  1566. #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
  1567. #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
  1568. #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
  1569. #endif
  1570. /* RaiseException.proto */
  1571. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
  1572. /* PyObjectCallMethO.proto */
  1573. #if CYTHON_COMPILING_IN_CPYTHON
  1574. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
  1575. #endif
  1576. /* PyObjectCallOneArg.proto */
  1577. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
  1578. /* DictGetItem.proto */
  1579. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  1580. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
  1581. #define __Pyx_PyObject_Dict_GetItem(obj, name)\
  1582. (likely(PyDict_CheckExact(obj)) ?\
  1583. __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
  1584. #else
  1585. #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
  1586. #define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name)
  1587. #endif
  1588. /* RaiseNoneIterError.proto */
  1589. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
  1590. /* ExtTypeTest.proto */
  1591. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
  1592. /* GetTopmostException.proto */
  1593. #if CYTHON_USE_EXC_INFO_STACK
  1594. static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
  1595. #endif
  1596. /* SaveResetException.proto */
  1597. #if CYTHON_FAST_THREAD_STATE
  1598. #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
  1599. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1600. #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
  1601. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
  1602. #else
  1603. #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
  1604. #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
  1605. #endif
  1606. /* PyErrExceptionMatches.proto */
  1607. #if CYTHON_FAST_THREAD_STATE
  1608. #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
  1609. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
  1610. #else
  1611. #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
  1612. #endif
  1613. /* GetException.proto */
  1614. #if CYTHON_FAST_THREAD_STATE
  1615. #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
  1616. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1617. #else
  1618. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
  1619. #endif
  1620. /* PyObjectCall2Args.proto */
  1621. static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
  1622. /* IncludeStringH.proto */
  1623. #include <string.h>
  1624. /* BytesEquals.proto */
  1625. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
  1626. /* UnicodeEquals.proto */
  1627. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
  1628. /* StrEquals.proto */
  1629. #if PY_MAJOR_VERSION >= 3
  1630. #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
  1631. #else
  1632. #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
  1633. #endif
  1634. /* None.proto */
  1635. static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
  1636. /* UnaryNegOverflows.proto */
  1637. #define UNARY_NEG_WOULD_OVERFLOW(x)\
  1638. (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
  1639. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  1640. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *); /*proto*/
  1641. /* GetAttr.proto */
  1642. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
  1643. /* decode_c_string_utf16.proto */
  1644. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(const char *s, Py_ssize_t size, const char *errors) {
  1645. int byteorder = 0;
  1646. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1647. }
  1648. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(const char *s, Py_ssize_t size, const char *errors) {
  1649. int byteorder = -1;
  1650. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1651. }
  1652. static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(const char *s, Py_ssize_t size, const char *errors) {
  1653. int byteorder = 1;
  1654. return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
  1655. }
  1656. /* decode_c_string.proto */
  1657. static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
  1658. const char* cstring, Py_ssize_t start, Py_ssize_t stop,
  1659. const char* encoding, const char* errors,
  1660. PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));
  1661. /* GetAttr3.proto */
  1662. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
  1663. /* SwapException.proto */
  1664. #if CYTHON_FAST_THREAD_STATE
  1665. #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
  1666. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
  1667. #else
  1668. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
  1669. #endif
  1670. /* Import.proto */
  1671. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
  1672. /* FastTypeChecks.proto */
  1673. #if CYTHON_COMPILING_IN_CPYTHON
  1674. #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
  1675. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
  1676. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
  1677. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
  1678. #else
  1679. #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
  1680. #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
  1681. #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
  1682. #endif
  1683. #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
  1684. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  1685. /* ListCompAppend.proto */
  1686. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1687. static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
  1688. PyListObject* L = (PyListObject*) list;
  1689. Py_ssize_t len = Py_SIZE(list);
  1690. if (likely(L->allocated > len)) {
  1691. Py_INCREF(x);
  1692. PyList_SET_ITEM(list, len, x);
  1693. Py_SIZE(list) = len+1;
  1694. return 0;
  1695. }
  1696. return PyList_Append(list, x);
  1697. }
  1698. #else
  1699. #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
  1700. #endif
  1701. /* PyIntBinop.proto */
  1702. #if !CYTHON_COMPILING_IN_PYPY
  1703. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
  1704. #else
  1705. #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
  1706. (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
  1707. #endif
  1708. /* ListExtend.proto */
  1709. static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
  1710. #if CYTHON_COMPILING_IN_CPYTHON
  1711. PyObject* none = _PyList_Extend((PyListObject*)L, v);
  1712. if (unlikely(!none))
  1713. return -1;
  1714. Py_DECREF(none);
  1715. return 0;
  1716. #else
  1717. return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
  1718. #endif
  1719. }
  1720. /* ListAppend.proto */
  1721. #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
  1722. static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  1723. PyListObject* L = (PyListObject*) list;
  1724. Py_ssize_t len = Py_SIZE(list);
  1725. if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
  1726. Py_INCREF(x);
  1727. PyList_SET_ITEM(list, len, x);
  1728. Py_SIZE(list) = len+1;
  1729. return 0;
  1730. }
  1731. return PyList_Append(list, x);
  1732. }
  1733. #else
  1734. #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
  1735. #endif
  1736. /* None.proto */
  1737. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
  1738. /* None.proto */
  1739. static CYTHON_INLINE long __Pyx_div_long(long, long);
  1740. /* ImportFrom.proto */
  1741. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
  1742. /* HasAttr.proto */
  1743. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *);
  1744. /* PyObject_GenericGetAttrNoDict.proto */
  1745. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1746. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
  1747. #else
  1748. #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
  1749. #endif
  1750. /* PyObject_GenericGetAttr.proto */
  1751. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  1752. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
  1753. #else
  1754. #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
  1755. #endif
  1756. /* SetVTable.proto */
  1757. static int __Pyx_SetVtable(PyObject *dict, void *vtable);
  1758. /* SetupReduce.proto */
  1759. static int __Pyx_setup_reduce(PyObject* type_obj);
  1760. /* TypeImport.proto */
  1761. #ifndef __PYX_HAVE_RT_ImportType_proto
  1762. #define __PYX_HAVE_RT_ImportType_proto
  1763. enum __Pyx_ImportType_CheckSize {
  1764. __Pyx_ImportType_CheckSize_Error = 0,
  1765. __Pyx_ImportType_CheckSize_Warn = 1,
  1766. __Pyx_ImportType_CheckSize_Ignore = 2
  1767. };
  1768. static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
  1769. #endif
  1770. /* CLineInTraceback.proto */
  1771. #ifdef CYTHON_CLINE_IN_TRACEBACK
  1772. #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
  1773. #else
  1774. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
  1775. #endif
  1776. /* CodeObjectCache.proto */
  1777. typedef struct {
  1778. PyCodeObject* code_object;
  1779. int code_line;
  1780. } __Pyx_CodeObjectCacheEntry;
  1781. struct __Pyx_CodeObjectCache {
  1782. int count;
  1783. int max_count;
  1784. __Pyx_CodeObjectCacheEntry* entries;
  1785. };
  1786. static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
  1787. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
  1788. static PyCodeObject *__pyx_find_code_object(int code_line);
  1789. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
  1790. /* AddTraceback.proto */
  1791. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  1792. int py_line, const char *filename);
  1793. #if PY_MAJOR_VERSION < 3
  1794. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
  1795. static void __Pyx_ReleaseBuffer(Py_buffer *view);
  1796. #else
  1797. #define __Pyx_GetBuffer PyObject_GetBuffer
  1798. #define __Pyx_ReleaseBuffer PyBuffer_Release
  1799. #endif
  1800. /* BufferStructDeclare.proto */
  1801. typedef struct {
  1802. Py_ssize_t shape, strides, suboffsets;
  1803. } __Pyx_Buf_DimInfo;
  1804. typedef struct {
  1805. size_t refcount;
  1806. Py_buffer pybuffer;
  1807. } __Pyx_Buffer;
  1808. typedef struct {
  1809. __Pyx_Buffer *rcbuffer;
  1810. char *data;
  1811. __Pyx_Buf_DimInfo diminfo[8];
  1812. } __Pyx_LocalBuf_ND;
  1813. /* MemviewSliceIsContig.proto */
  1814. static int __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim);
  1815. /* OverlappingSlices.proto */
  1816. static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
  1817. __Pyx_memviewslice *slice2,
  1818. int ndim, size_t itemsize);
  1819. /* Capsule.proto */
  1820. static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig);
  1821. /* CppExceptionConversion.proto */
  1822. #ifndef __Pyx_CppExn2PyErr
  1823. #include <new>
  1824. #include <typeinfo>
  1825. #include <stdexcept>
  1826. #include <ios>
  1827. static void __Pyx_CppExn2PyErr() {
  1828. try {
  1829. if (PyErr_Occurred())
  1830. ; // let the latest Python exn pass through and ignore the current one
  1831. else
  1832. throw;
  1833. } catch (const std::bad_alloc& exn) {
  1834. PyErr_SetString(PyExc_MemoryError, exn.what());
  1835. } catch (const std::bad_cast& exn) {
  1836. PyErr_SetString(PyExc_TypeError, exn.what());
  1837. } catch (const std::bad_typeid& exn) {
  1838. PyErr_SetString(PyExc_TypeError, exn.what());
  1839. } catch (const std::domain_error& exn) {
  1840. PyErr_SetString(PyExc_ValueError, exn.what());
  1841. } catch (const std::invalid_argument& exn) {
  1842. PyErr_SetString(PyExc_ValueError, exn.what());
  1843. } catch (const std::ios_base::failure& exn) {
  1844. PyErr_SetString(PyExc_IOError, exn.what());
  1845. } catch (const std::out_of_range& exn) {
  1846. PyErr_SetString(PyExc_IndexError, exn.what());
  1847. } catch (const std::overflow_error& exn) {
  1848. PyErr_SetString(PyExc_OverflowError, exn.what());
  1849. } catch (const std::range_error& exn) {
  1850. PyErr_SetString(PyExc_ArithmeticError, exn.what());
  1851. } catch (const std::underflow_error& exn) {
  1852. PyErr_SetString(PyExc_ArithmeticError, exn.what());
  1853. } catch (const std::exception& exn) {
  1854. PyErr_SetString(PyExc_RuntimeError, exn.what());
  1855. }
  1856. catch (...)
  1857. {
  1858. PyErr_SetString(PyExc_RuntimeError, "Unknown exception");
  1859. }
  1860. }
  1861. #endif
  1862. /* CIntToPy.proto */
  1863. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
  1864. /* RealImag.proto */
  1865. #if CYTHON_CCOMPLEX
  1866. #ifdef __cplusplus
  1867. #define __Pyx_CREAL(z) ((z).real())
  1868. #define __Pyx_CIMAG(z) ((z).imag())
  1869. #else
  1870. #define __Pyx_CREAL(z) (__real__(z))
  1871. #define __Pyx_CIMAG(z) (__imag__(z))
  1872. #endif
  1873. #else
  1874. #define __Pyx_CREAL(z) ((z).real)
  1875. #define __Pyx_CIMAG(z) ((z).imag)
  1876. #endif
  1877. #if defined(__cplusplus) && CYTHON_CCOMPLEX\
  1878. && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
  1879. #define __Pyx_SET_CREAL(z,x) ((z).real(x))
  1880. #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
  1881. #else
  1882. #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
  1883. #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
  1884. #endif
  1885. /* Arithmetic.proto */
  1886. #if CYTHON_CCOMPLEX
  1887. #define __Pyx_c_eq_float(a, b) ((a)==(b))
  1888. #define __Pyx_c_sum_float(a, b) ((a)+(b))
  1889. #define __Pyx_c_diff_float(a, b) ((a)-(b))
  1890. #define __Pyx_c_prod_float(a, b) ((a)*(b))
  1891. #define __Pyx_c_quot_float(a, b) ((a)/(b))
  1892. #define __Pyx_c_neg_float(a) (-(a))
  1893. #ifdef __cplusplus
  1894. #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
  1895. #define __Pyx_c_conj_float(z) (::std::conj(z))
  1896. #if 1
  1897. #define __Pyx_c_abs_float(z) (::std::abs(z))
  1898. #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
  1899. #endif
  1900. #else
  1901. #define __Pyx_c_is_zero_float(z) ((z)==0)
  1902. #define __Pyx_c_conj_float(z) (conjf(z))
  1903. #if 1
  1904. #define __Pyx_c_abs_float(z) (cabsf(z))
  1905. #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
  1906. #endif
  1907. #endif
  1908. #else
  1909. static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1910. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1911. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1912. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1913. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1914. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
  1915. static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
  1916. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
  1917. #if 1
  1918. static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
  1919. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
  1920. #endif
  1921. #endif
  1922. /* Arithmetic.proto */
  1923. #if CYTHON_CCOMPLEX
  1924. #define __Pyx_c_eq_double(a, b) ((a)==(b))
  1925. #define __Pyx_c_sum_double(a, b) ((a)+(b))
  1926. #define __Pyx_c_diff_double(a, b) ((a)-(b))
  1927. #define __Pyx_c_prod_double(a, b) ((a)*(b))
  1928. #define __Pyx_c_quot_double(a, b) ((a)/(b))
  1929. #define __Pyx_c_neg_double(a) (-(a))
  1930. #ifdef __cplusplus
  1931. #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
  1932. #define __Pyx_c_conj_double(z) (::std::conj(z))
  1933. #if 1
  1934. #define __Pyx_c_abs_double(z) (::std::abs(z))
  1935. #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
  1936. #endif
  1937. #else
  1938. #define __Pyx_c_is_zero_double(z) ((z)==0)
  1939. #define __Pyx_c_conj_double(z) (conj(z))
  1940. #if 1
  1941. #define __Pyx_c_abs_double(z) (cabs(z))
  1942. #define __Pyx_c_pow_double(a, b) (cpow(a, b))
  1943. #endif
  1944. #endif
  1945. #else
  1946. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1947. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1948. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1949. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1950. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1951. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
  1952. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
  1953. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
  1954. #if 1
  1955. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
  1956. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
  1957. #endif
  1958. #endif
  1959. /* CIntToPy.proto */
  1960. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
  1961. /* MemviewSliceCopyTemplate.proto */
  1962. static __Pyx_memviewslice
  1963. __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
  1964. const char *mode, int ndim,
  1965. size_t sizeof_dtype, int contig_flag,
  1966. int dtype_is_object);
  1967. /* CIntFromPy.proto */
  1968. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
  1969. /* CIntFromPy.proto */
  1970. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
  1971. /* CIntToPy.proto */
  1972. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
  1973. /* CIntFromPy.proto */
  1974. static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *);
  1975. /* IsLittleEndian.proto */
  1976. static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);
  1977. /* BufferFormatCheck.proto */
  1978. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
  1979. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  1980. __Pyx_BufFmt_StackElem* stack,
  1981. __Pyx_TypeInfo* type);
  1982. /* TypeInfoCompare.proto */
  1983. static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
  1984. /* MemviewSliceValidateAndInit.proto */
  1985. static int __Pyx_ValidateAndInit_memviewslice(
  1986. int *axes_specs,
  1987. int c_or_f_flag,
  1988. int buf_flags,
  1989. int ndim,
  1990. __Pyx_TypeInfo *dtype,
  1991. __Pyx_BufFmt_StackElem stack[],
  1992. __Pyx_memviewslice *memviewslice,
  1993. PyObject *original_obj);
  1994. /* ObjectToMemviewSlice.proto */
  1995. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *, int writable_flag);
  1996. /* ObjectToMemviewSlice.proto */
  1997. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_char(PyObject *, int writable_flag);
  1998. /* ObjectToMemviewSlice.proto */
  1999. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float__const__(PyObject *, int writable_flag);
  2000. /* ObjectToMemviewSlice.proto */
  2001. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *, int writable_flag);
  2002. /* CheckBinaryVersion.proto */
  2003. static int __Pyx_check_binary_version(void);
  2004. /* InitStrings.proto */
  2005. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
  2006. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self); /* proto*/
  2007. static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto*/
  2008. static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj); /* proto*/
  2009. static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src); /* proto*/
  2010. 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*/
  2011. static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /* proto*/
  2012. static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
  2013. static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
  2014. static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp); /* proto*/
  2015. static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value); /* proto*/
  2016. /* Module declarations from 'cython.view' */
  2017. /* Module declarations from 'cython' */
  2018. /* Module declarations from 'cpython.buffer' */
  2019. /* Module declarations from 'libc.string' */
  2020. /* Module declarations from 'libc.stdio' */
  2021. /* Module declarations from '__builtin__' */
  2022. /* Module declarations from 'cpython.type' */
  2023. static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
  2024. /* Module declarations from 'cpython' */
  2025. /* Module declarations from 'cpython.object' */
  2026. /* Module declarations from 'cpython.ref' */
  2027. /* Module declarations from 'cpython.mem' */
  2028. /* Module declarations from 'numpy' */
  2029. /* Module declarations from 'numpy' */
  2030. static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
  2031. static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
  2032. static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
  2033. static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
  2034. static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
  2035. static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
  2036. /* Module declarations from 'libcpp.queue' */
  2037. /* Module declarations from 'libcpp.utility' */
  2038. /* Module declarations from 'libcpp.pair' */
  2039. /* Module declarations from 'app.trade.trade_utils' */
  2040. static PyTypeObject *__pyx_array_type = 0;
  2041. static PyTypeObject *__pyx_MemviewEnum_type = 0;
  2042. static PyTypeObject *__pyx_memoryview_type = 0;
  2043. static PyTypeObject *__pyx_memoryviewslice_type = 0;
  2044. static PyObject *generic = 0;
  2045. static PyObject *strided = 0;
  2046. static PyObject *indirect = 0;
  2047. static PyObject *contiguous = 0;
  2048. static PyObject *indirect_contiguous = 0;
  2049. static int __pyx_memoryview_thread_locks_used;
  2050. static PyThread_type_lock __pyx_memoryview_thread_locks[8];
  2051. static PyObject *__pyx_f_3app_5trade_11trade_utils_hex_neighbors(int const , int const , __Pyx_memviewslice); /*proto*/
  2052. static PyObject *__pyx_f_3app_5trade_11trade_utils__trade_distance(int, int, float, __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice); /*proto*/
  2053. static PyObject *__pyx_f_3app_5trade_11trade_utils_update_export_partner(PyArrayObject *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/
  2054. static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t, char *, char *, char *); /*proto*/
  2055. static void *__pyx_align_pointer(void *, size_t); /*proto*/
  2056. static PyObject *__pyx_memoryview_new(PyObject *, int, int, __Pyx_TypeInfo *); /*proto*/
  2057. static CYTHON_INLINE int __pyx_memoryview_check(PyObject *); /*proto*/
  2058. static PyObject *_unellipsify(PyObject *, int); /*proto*/
  2059. static PyObject *assert_direct_dimensions(Py_ssize_t *, int); /*proto*/
  2060. static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *, PyObject *); /*proto*/
  2061. 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*/
  2062. static char *__pyx_pybuffer_index(Py_buffer *, char *, Py_ssize_t, Py_ssize_t); /*proto*/
  2063. static int __pyx_memslice_transpose(__Pyx_memviewslice *); /*proto*/
  2064. static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice, int, PyObject *(*)(char *), int (*)(char *, PyObject *), int); /*proto*/
  2065. static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  2066. static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  2067. static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *); /*proto*/
  2068. static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *, __Pyx_memviewslice *); /*proto*/
  2069. static Py_ssize_t abs_py_ssize_t(Py_ssize_t); /*proto*/
  2070. static char __pyx_get_best_slice_order(__Pyx_memviewslice *, int); /*proto*/
  2071. static void _copy_strided_to_strided(char *, Py_ssize_t *, char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *, int, size_t); /*proto*/
  2072. static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *, int, size_t); /*proto*/
  2073. static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *, int); /*proto*/
  2074. static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t, int, char); /*proto*/
  2075. static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *, char, int); /*proto*/
  2076. static int __pyx_memoryview_err_extents(int, Py_ssize_t, Py_ssize_t); /*proto*/
  2077. static int __pyx_memoryview_err_dim(PyObject *, char *, int); /*proto*/
  2078. static int __pyx_memoryview_err(PyObject *, char *); /*proto*/
  2079. static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice, int, int, int); /*proto*/
  2080. static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *, int, int); /*proto*/
  2081. static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *, int, int, int); /*proto*/
  2082. static void __pyx_memoryview_refcount_objects_in_slice_with_gil(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
  2083. static void __pyx_memoryview_refcount_objects_in_slice(char *, Py_ssize_t *, Py_ssize_t *, int, int); /*proto*/
  2084. static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *, int, size_t, void *, int); /*proto*/
  2085. static void __pyx_memoryview__slice_assign_scalar(char *, Py_ssize_t *, Py_ssize_t *, int, size_t, void *); /*proto*/
  2086. static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *, PyObject *); /*proto*/
  2087. static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), { 0 }, 0, IS_UNSIGNED(int) ? 'U' : 'I', IS_UNSIGNED(int), 0 };
  2088. static __Pyx_TypeInfo __Pyx_TypeInfo_char = { "char", NULL, sizeof(char), { 0 }, 0, 'H', IS_UNSIGNED(char), 0 };
  2089. static __Pyx_TypeInfo __Pyx_TypeInfo_float__const__ = { "const float", NULL, sizeof(float const ), { 0 }, 0, 'R', 0, 0 };
  2090. static __Pyx_TypeInfo __Pyx_TypeInfo_float = { "float", NULL, sizeof(float), { 0 }, 0, 'R', 0, 0 };
  2091. #define __Pyx_MODULE_NAME "app.trade.trade_utils"
  2092. extern int __pyx_module_is_main_app__trade__trade_utils;
  2093. int __pyx_module_is_main_app__trade__trade_utils = 0;
  2094. /* Implementation of 'app.trade.trade_utils' */
  2095. static PyObject *__pyx_builtin_range;
  2096. static PyObject *__pyx_builtin_ValueError;
  2097. static PyObject *__pyx_builtin_RuntimeError;
  2098. static PyObject *__pyx_builtin_ImportError;
  2099. static PyObject *__pyx_builtin_MemoryError;
  2100. static PyObject *__pyx_builtin_enumerate;
  2101. static PyObject *__pyx_builtin_TypeError;
  2102. static PyObject *__pyx_builtin_Ellipsis;
  2103. static PyObject *__pyx_builtin_id;
  2104. static PyObject *__pyx_builtin_IndexError;
  2105. static const char __pyx_k_O[] = "O";
  2106. static const char __pyx_k_c[] = "c";
  2107. static const char __pyx_k_i[] = "i";
  2108. static const char __pyx_k_j[] = "j";
  2109. static const char __pyx_k_id[] = "id";
  2110. static const char __pyx_k_np[] = "np";
  2111. static const char __pyx_k_exp[] = "exp";
  2112. static const char __pyx_k_new[] = "__new__";
  2113. static const char __pyx_k_obj[] = "obj";
  2114. static const char __pyx_k_base[] = "base";
  2115. static const char __pyx_k_dict[] = "__dict__";
  2116. static const char __pyx_k_full[] = "full";
  2117. static const char __pyx_k_int8[] = "int8";
  2118. static const char __pyx_k_main[] = "__main__";
  2119. static const char __pyx_k_mode[] = "mode";
  2120. static const char __pyx_k_name[] = "name";
  2121. static const char __pyx_k_ndim[] = "ndim";
  2122. static const char __pyx_k_pack[] = "pack";
  2123. static const char __pyx_k_size[] = "size";
  2124. static const char __pyx_k_step[] = "step";
  2125. static const char __pyx_k_stop[] = "stop";
  2126. static const char __pyx_k_test[] = "__test__";
  2127. static const char __pyx_k_ASCII[] = "ASCII";
  2128. static const char __pyx_k_class[] = "__class__";
  2129. static const char __pyx_k_dtype[] = "dtype";
  2130. static const char __pyx_k_error[] = "error";
  2131. static const char __pyx_k_flags[] = "flags";
  2132. static const char __pyx_k_int32[] = "int32";
  2133. static const char __pyx_k_numpy[] = "numpy";
  2134. static const char __pyx_k_range[] = "range";
  2135. static const char __pyx_k_shape[] = "shape";
  2136. static const char __pyx_k_start[] = "start";
  2137. static const char __pyx_k_zeros[] = "zeros";
  2138. static const char __pyx_k_encode[] = "encode";
  2139. static const char __pyx_k_format[] = "format";
  2140. static const char __pyx_k_import[] = "__import__";
  2141. static const char __pyx_k_name_2[] = "__name__";
  2142. static const char __pyx_k_pickle[] = "pickle";
  2143. static const char __pyx_k_reduce[] = "__reduce__";
  2144. static const char __pyx_k_struct[] = "struct";
  2145. static const char __pyx_k_unpack[] = "unpack";
  2146. static const char __pyx_k_update[] = "update";
  2147. static const char __pyx_k_fortran[] = "fortran";
  2148. static const char __pyx_k_memview[] = "memview";
  2149. static const char __pyx_k_Ellipsis[] = "Ellipsis";
  2150. static const char __pyx_k_distance[] = "distance";
  2151. static const char __pyx_k_getstate[] = "__getstate__";
  2152. static const char __pyx_k_itemsize[] = "itemsize";
  2153. static const char __pyx_k_pyx_type[] = "__pyx_type";
  2154. static const char __pyx_k_setstate[] = "__setstate__";
  2155. static const char __pyx_k_TypeError[] = "TypeError";
  2156. static const char __pyx_k_enumerate[] = "enumerate";
  2157. static const char __pyx_k_full_like[] = "full_like";
  2158. static const char __pyx_k_pyx_state[] = "__pyx_state";
  2159. static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
  2160. static const char __pyx_k_IndexError[] = "IndexError";
  2161. static const char __pyx_k_ValueError[] = "ValueError";
  2162. static const char __pyx_k_pyx_result[] = "__pyx_result";
  2163. static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
  2164. static const char __pyx_k_ImportError[] = "ImportError";
  2165. static const char __pyx_k_MemoryError[] = "MemoryError";
  2166. static const char __pyx_k_PickleError[] = "PickleError";
  2167. static const char __pyx_k_trade_range[] = "trade_range";
  2168. static const char __pyx_k_trade_value[] = "trade_value";
  2169. static const char __pyx_k_RuntimeError[] = "RuntimeError";
  2170. static const char __pyx_k_pyx_checksum[] = "__pyx_checksum";
  2171. static const char __pyx_k_stringsource[] = "stringsource";
  2172. static const char __pyx_k_pyx_getbuffer[] = "__pyx_getbuffer";
  2173. static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
  2174. static const char __pyx_k_export_partner[] = "export_partner";
  2175. static const char __pyx_k_trade_distance[] = "trade_distance";
  2176. static const char __pyx_k_View_MemoryView[] = "View.MemoryView";
  2177. static const char __pyx_k_allocate_buffer[] = "allocate_buffer";
  2178. static const char __pyx_k_dtype_is_object[] = "dtype_is_object";
  2179. static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError";
  2180. static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
  2181. static const char __pyx_k_pyx_unpickle_Enum[] = "__pyx_unpickle_Enum";
  2182. static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
  2183. static const char __pyx_k_strided_and_direct[] = "<strided and direct>";
  2184. static const char __pyx_k_strided_and_indirect[] = "<strided and indirect>";
  2185. static const char __pyx_k_trade_traversal_cost[] = "trade_traversal_cost";
  2186. static const char __pyx_k_app_trade_trade_utils[] = "app.trade.trade_utils";
  2187. static const char __pyx_k_contiguous_and_direct[] = "<contiguous and direct>";
  2188. static const char __pyx_k_MemoryView_of_r_object[] = "<MemoryView of %r object>";
  2189. static const char __pyx_k_MemoryView_of_r_at_0x_x[] = "<MemoryView of %r at 0x%x>";
  2190. static const char __pyx_k_contiguous_and_indirect[] = "<contiguous and indirect>";
  2191. static const char __pyx_k_Cannot_index_with_type_s[] = "Cannot index with type '%s'";
  2192. static const char __pyx_k_Invalid_shape_in_axis_d_d[] = "Invalid shape in axis %d: %d.";
  2193. static const char __pyx_k_app_trade_trade_utils_pyx[] = "app/trade/trade_utils.pyx";
  2194. static const char __pyx_k_itemsize_0_for_cython_array[] = "itemsize <= 0 for cython.array";
  2195. static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
  2196. static const char __pyx_k_unable_to_allocate_array_data[] = "unable to allocate array data.";
  2197. static const char __pyx_k_strided_and_direct_or_indirect[] = "<strided and direct or indirect>";
  2198. static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
  2199. static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
  2200. static const char __pyx_k_Buffer_view_does_not_expose_stri[] = "Buffer view does not expose strides";
  2201. static const char __pyx_k_Can_only_create_a_buffer_that_is[] = "Can only create a buffer that is contiguous in memory.";
  2202. static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to read-only memoryview";
  2203. static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview";
  2204. static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array";
  2205. static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
  2206. static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))";
  2207. static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported";
  2208. static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s";
  2209. static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
  2210. static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)";
  2211. static const char __pyx_k_Unable_to_convert_item_to_object[] = "Unable to convert item to object";
  2212. static const char __pyx_k_got_differing_extents_in_dimensi[] = "got differing extents in dimension %d (got %d and %d)";
  2213. static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
  2214. static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
  2215. static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
  2216. static const char __pyx_k_unable_to_allocate_shape_and_str[] = "unable to allocate shape and strides.";
  2217. static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
  2218. static PyObject *__pyx_n_s_ASCII;
  2219. static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
  2220. static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
  2221. static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
  2222. static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
  2223. static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
  2224. static PyObject *__pyx_n_s_Ellipsis;
  2225. static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
  2226. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
  2227. static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
  2228. static PyObject *__pyx_n_s_ImportError;
  2229. static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
  2230. static PyObject *__pyx_n_s_IndexError;
  2231. static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
  2232. static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
  2233. static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
  2234. static PyObject *__pyx_n_s_MemoryError;
  2235. static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
  2236. static PyObject *__pyx_kp_s_MemoryView_of_r_object;
  2237. static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
  2238. static PyObject *__pyx_n_b_O;
  2239. static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
  2240. static PyObject *__pyx_n_s_PickleError;
  2241. static PyObject *__pyx_n_s_RuntimeError;
  2242. static PyObject *__pyx_n_s_TypeError;
  2243. static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
  2244. static PyObject *__pyx_n_s_ValueError;
  2245. static PyObject *__pyx_n_s_View_MemoryView;
  2246. static PyObject *__pyx_n_s_allocate_buffer;
  2247. static PyObject *__pyx_n_s_app_trade_trade_utils;
  2248. static PyObject *__pyx_kp_s_app_trade_trade_utils_pyx;
  2249. static PyObject *__pyx_n_s_base;
  2250. static PyObject *__pyx_n_s_c;
  2251. static PyObject *__pyx_n_u_c;
  2252. static PyObject *__pyx_n_s_class;
  2253. static PyObject *__pyx_n_s_cline_in_traceback;
  2254. static PyObject *__pyx_kp_s_contiguous_and_direct;
  2255. static PyObject *__pyx_kp_s_contiguous_and_indirect;
  2256. static PyObject *__pyx_n_s_dict;
  2257. static PyObject *__pyx_n_s_distance;
  2258. static PyObject *__pyx_n_s_dtype;
  2259. static PyObject *__pyx_n_s_dtype_is_object;
  2260. static PyObject *__pyx_n_s_encode;
  2261. static PyObject *__pyx_n_s_enumerate;
  2262. static PyObject *__pyx_n_s_error;
  2263. static PyObject *__pyx_n_s_exp;
  2264. static PyObject *__pyx_n_s_export_partner;
  2265. static PyObject *__pyx_n_s_flags;
  2266. static PyObject *__pyx_n_s_format;
  2267. static PyObject *__pyx_n_s_fortran;
  2268. static PyObject *__pyx_n_u_fortran;
  2269. static PyObject *__pyx_n_s_full;
  2270. static PyObject *__pyx_n_s_full_like;
  2271. static PyObject *__pyx_n_s_getstate;
  2272. static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
  2273. static PyObject *__pyx_n_s_i;
  2274. static PyObject *__pyx_n_s_id;
  2275. static PyObject *__pyx_n_s_import;
  2276. static PyObject *__pyx_n_s_int32;
  2277. static PyObject *__pyx_n_s_int8;
  2278. static PyObject *__pyx_n_s_itemsize;
  2279. static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
  2280. static PyObject *__pyx_n_s_j;
  2281. static PyObject *__pyx_n_s_main;
  2282. static PyObject *__pyx_n_s_memview;
  2283. static PyObject *__pyx_n_s_mode;
  2284. static PyObject *__pyx_n_s_name;
  2285. static PyObject *__pyx_n_s_name_2;
  2286. static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
  2287. static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
  2288. static PyObject *__pyx_n_s_ndim;
  2289. static PyObject *__pyx_n_s_new;
  2290. static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
  2291. static PyObject *__pyx_n_s_np;
  2292. static PyObject *__pyx_n_s_numpy;
  2293. static PyObject *__pyx_kp_u_numpy_core_multiarray_failed_to;
  2294. static PyObject *__pyx_kp_u_numpy_core_umath_failed_to_impor;
  2295. static PyObject *__pyx_n_s_obj;
  2296. static PyObject *__pyx_n_s_pack;
  2297. static PyObject *__pyx_n_s_pickle;
  2298. static PyObject *__pyx_n_s_pyx_PickleError;
  2299. static PyObject *__pyx_n_s_pyx_checksum;
  2300. static PyObject *__pyx_n_s_pyx_getbuffer;
  2301. static PyObject *__pyx_n_s_pyx_result;
  2302. static PyObject *__pyx_n_s_pyx_state;
  2303. static PyObject *__pyx_n_s_pyx_type;
  2304. static PyObject *__pyx_n_s_pyx_unpickle_Enum;
  2305. static PyObject *__pyx_n_s_pyx_vtable;
  2306. static PyObject *__pyx_n_s_range;
  2307. static PyObject *__pyx_n_s_reduce;
  2308. static PyObject *__pyx_n_s_reduce_cython;
  2309. static PyObject *__pyx_n_s_reduce_ex;
  2310. static PyObject *__pyx_n_s_setstate;
  2311. static PyObject *__pyx_n_s_setstate_cython;
  2312. static PyObject *__pyx_n_s_shape;
  2313. static PyObject *__pyx_n_s_size;
  2314. static PyObject *__pyx_n_s_start;
  2315. static PyObject *__pyx_n_s_step;
  2316. static PyObject *__pyx_n_s_stop;
  2317. static PyObject *__pyx_kp_s_strided_and_direct;
  2318. static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
  2319. static PyObject *__pyx_kp_s_strided_and_indirect;
  2320. static PyObject *__pyx_kp_s_stringsource;
  2321. static PyObject *__pyx_n_s_struct;
  2322. static PyObject *__pyx_n_s_test;
  2323. static PyObject *__pyx_n_s_trade_distance;
  2324. static PyObject *__pyx_n_s_trade_range;
  2325. static PyObject *__pyx_n_s_trade_traversal_cost;
  2326. static PyObject *__pyx_n_s_trade_value;
  2327. static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
  2328. static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
  2329. static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
  2330. static PyObject *__pyx_n_s_unpack;
  2331. static PyObject *__pyx_n_s_update;
  2332. static PyObject *__pyx_n_s_zeros;
  2333. static PyObject *__pyx_pf_3app_5trade_11trade_utils_trade_distance(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_i, int __pyx_v_j, float __pyx_v_trade_range, PyArrayObject *__pyx_v_trade_traversal_cost, PyArrayObject *__pyx_v_trade_value); /* proto */
  2334. static PyObject *__pyx_pf_3app_5trade_11trade_utils_2update_export_partner(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_trade_range, PyArrayObject *__pyx_v_trade_distance, PyArrayObject *__pyx_v_trade_value, PyArrayObject *__pyx_v_export_partner); /* proto */
  2335. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
  2336. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
  2337. 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 */
  2338. 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 */
  2339. static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  2340. static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  2341. static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self); /* proto */
  2342. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr); /* proto */
  2343. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item); /* proto */
  2344. 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 */
  2345. static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self); /* proto */
  2346. 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 */
  2347. static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
  2348. static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
  2349. static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self); /* proto */
  2350. static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */
  2351. 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 */
  2352. static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2353. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index); /* proto */
  2354. 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 */
  2355. 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 */
  2356. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2357. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2358. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2359. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2360. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2361. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2362. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2363. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2364. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2365. static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2366. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2367. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2368. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2369. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2370. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2371. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2372. static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self); /* proto */
  2373. 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 */
  2374. static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  2375. static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  2376. static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self); /* proto */
  2377. 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 */
  2378. 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 */
  2379. static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2380. static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2381. static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2382. static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
  2383. static PyObject *__pyx_int_0;
  2384. static PyObject *__pyx_int_1;
  2385. static PyObject *__pyx_int_2;
  2386. static PyObject *__pyx_int_6;
  2387. static PyObject *__pyx_int_184977713;
  2388. static PyObject *__pyx_int_neg_1;
  2389. static PyObject *__pyx_tuple_;
  2390. static PyObject *__pyx_tuple__2;
  2391. static PyObject *__pyx_tuple__3;
  2392. static PyObject *__pyx_tuple__4;
  2393. static PyObject *__pyx_tuple__5;
  2394. static PyObject *__pyx_tuple__6;
  2395. static PyObject *__pyx_tuple__7;
  2396. static PyObject *__pyx_tuple__8;
  2397. static PyObject *__pyx_tuple__9;
  2398. static PyObject *__pyx_slice__24;
  2399. static PyObject *__pyx_tuple__10;
  2400. static PyObject *__pyx_tuple__11;
  2401. static PyObject *__pyx_tuple__12;
  2402. static PyObject *__pyx_tuple__13;
  2403. static PyObject *__pyx_tuple__14;
  2404. static PyObject *__pyx_tuple__15;
  2405. static PyObject *__pyx_tuple__16;
  2406. static PyObject *__pyx_tuple__17;
  2407. static PyObject *__pyx_tuple__18;
  2408. static PyObject *__pyx_tuple__19;
  2409. static PyObject *__pyx_tuple__20;
  2410. static PyObject *__pyx_tuple__21;
  2411. static PyObject *__pyx_tuple__22;
  2412. static PyObject *__pyx_tuple__23;
  2413. static PyObject *__pyx_tuple__25;
  2414. static PyObject *__pyx_tuple__26;
  2415. static PyObject *__pyx_tuple__27;
  2416. static PyObject *__pyx_tuple__28;
  2417. static PyObject *__pyx_tuple__30;
  2418. static PyObject *__pyx_tuple__31;
  2419. static PyObject *__pyx_tuple__32;
  2420. static PyObject *__pyx_tuple__33;
  2421. static PyObject *__pyx_tuple__34;
  2422. static PyObject *__pyx_tuple__35;
  2423. static PyObject *__pyx_codeobj__29;
  2424. static PyObject *__pyx_codeobj__36;
  2425. /* Late includes */
  2426. /* "app/trade/trade_utils.pyx":15
  2427. * @cython.boundscheck(False)
  2428. * @cython.wraparound(False)
  2429. * cdef hex_neighbors(const int i, const int j, int[:,:] out): # <<<<<<<<<<<<<<
  2430. * cdef int ii, jj
  2431. * out[0][0], out[0][1] = i, j+1 # UU
  2432. */
  2433. static PyObject *__pyx_f_3app_5trade_11trade_utils_hex_neighbors(int const __pyx_v_i, int const __pyx_v_j, __Pyx_memviewslice __pyx_v_out) {
  2434. PyObject *__pyx_r = NULL;
  2435. __Pyx_RefNannyDeclarations
  2436. int __pyx_t_1;
  2437. long __pyx_t_2;
  2438. Py_ssize_t __pyx_t_3;
  2439. Py_ssize_t __pyx_t_4;
  2440. Py_ssize_t __pyx_t_5;
  2441. Py_ssize_t __pyx_t_6;
  2442. Py_ssize_t __pyx_t_7;
  2443. Py_ssize_t __pyx_t_8;
  2444. Py_ssize_t __pyx_t_9;
  2445. Py_ssize_t __pyx_t_10;
  2446. int __pyx_t_11;
  2447. Py_ssize_t __pyx_t_12;
  2448. Py_ssize_t __pyx_t_13;
  2449. Py_ssize_t __pyx_t_14;
  2450. Py_ssize_t __pyx_t_15;
  2451. long __pyx_t_16;
  2452. Py_ssize_t __pyx_t_17;
  2453. Py_ssize_t __pyx_t_18;
  2454. Py_ssize_t __pyx_t_19;
  2455. Py_ssize_t __pyx_t_20;
  2456. Py_ssize_t __pyx_t_21;
  2457. Py_ssize_t __pyx_t_22;
  2458. Py_ssize_t __pyx_t_23;
  2459. Py_ssize_t __pyx_t_24;
  2460. Py_ssize_t __pyx_t_25;
  2461. Py_ssize_t __pyx_t_26;
  2462. Py_ssize_t __pyx_t_27;
  2463. Py_ssize_t __pyx_t_28;
  2464. Py_ssize_t __pyx_t_29;
  2465. Py_ssize_t __pyx_t_30;
  2466. Py_ssize_t __pyx_t_31;
  2467. Py_ssize_t __pyx_t_32;
  2468. Py_ssize_t __pyx_t_33;
  2469. Py_ssize_t __pyx_t_34;
  2470. Py_ssize_t __pyx_t_35;
  2471. Py_ssize_t __pyx_t_36;
  2472. Py_ssize_t __pyx_t_37;
  2473. Py_ssize_t __pyx_t_38;
  2474. Py_ssize_t __pyx_t_39;
  2475. Py_ssize_t __pyx_t_40;
  2476. Py_ssize_t __pyx_t_41;
  2477. Py_ssize_t __pyx_t_42;
  2478. Py_ssize_t __pyx_t_43;
  2479. Py_ssize_t __pyx_t_44;
  2480. __Pyx_RefNannySetupContext("hex_neighbors", 0);
  2481. /* "app/trade/trade_utils.pyx":17
  2482. * cdef hex_neighbors(const int i, const int j, int[:,:] out):
  2483. * cdef int ii, jj
  2484. * out[0][0], out[0][1] = i, j+1 # UU # <<<<<<<<<<<<<<
  2485. * out[1][0], out[1][1] = i, j-1 # DD
  2486. * if i % 2 == 0: # even rows
  2487. */
  2488. __pyx_t_1 = __pyx_v_i;
  2489. __pyx_t_2 = (__pyx_v_j + 1);
  2490. __pyx_t_3 = 0;
  2491. __pyx_t_4 = 0;
  2492. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_3 * __pyx_v_out.strides[0]) ) + __pyx_t_4 * __pyx_v_out.strides[1]) )) = __pyx_t_1;
  2493. __pyx_t_5 = 0;
  2494. __pyx_t_6 = 1;
  2495. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_5 * __pyx_v_out.strides[0]) ) + __pyx_t_6 * __pyx_v_out.strides[1]) )) = __pyx_t_2;
  2496. /* "app/trade/trade_utils.pyx":18
  2497. * cdef int ii, jj
  2498. * out[0][0], out[0][1] = i, j+1 # UU
  2499. * out[1][0], out[1][1] = i, j-1 # DD # <<<<<<<<<<<<<<
  2500. * if i % 2 == 0: # even rows
  2501. * out[2][0], out[2][1] = i+1, j # UR
  2502. */
  2503. __pyx_t_1 = __pyx_v_i;
  2504. __pyx_t_2 = (__pyx_v_j - 1);
  2505. __pyx_t_7 = 1;
  2506. __pyx_t_8 = 0;
  2507. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_7 * __pyx_v_out.strides[0]) ) + __pyx_t_8 * __pyx_v_out.strides[1]) )) = __pyx_t_1;
  2508. __pyx_t_9 = 1;
  2509. __pyx_t_10 = 1;
  2510. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_9 * __pyx_v_out.strides[0]) ) + __pyx_t_10 * __pyx_v_out.strides[1]) )) = __pyx_t_2;
  2511. /* "app/trade/trade_utils.pyx":19
  2512. * out[0][0], out[0][1] = i, j+1 # UU
  2513. * out[1][0], out[1][1] = i, j-1 # DD
  2514. * if i % 2 == 0: # even rows # <<<<<<<<<<<<<<
  2515. * out[2][0], out[2][1] = i+1, j # UR
  2516. * out[3][0], out[3][1] = i+1, j-1 # DR
  2517. */
  2518. __pyx_t_11 = ((__Pyx_mod_long(__pyx_v_i, 2) == 0) != 0);
  2519. if (__pyx_t_11) {
  2520. /* "app/trade/trade_utils.pyx":20
  2521. * out[1][0], out[1][1] = i, j-1 # DD
  2522. * if i % 2 == 0: # even rows
  2523. * out[2][0], out[2][1] = i+1, j # UR # <<<<<<<<<<<<<<
  2524. * out[3][0], out[3][1] = i+1, j-1 # DR
  2525. * out[4][0], out[4][1] = i-1, j-1 # DL
  2526. */
  2527. __pyx_t_2 = (__pyx_v_i + 1);
  2528. __pyx_t_1 = __pyx_v_j;
  2529. __pyx_t_12 = 2;
  2530. __pyx_t_13 = 0;
  2531. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_12 * __pyx_v_out.strides[0]) ) + __pyx_t_13 * __pyx_v_out.strides[1]) )) = __pyx_t_2;
  2532. __pyx_t_14 = 2;
  2533. __pyx_t_15 = 1;
  2534. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_14 * __pyx_v_out.strides[0]) ) + __pyx_t_15 * __pyx_v_out.strides[1]) )) = __pyx_t_1;
  2535. /* "app/trade/trade_utils.pyx":21
  2536. * if i % 2 == 0: # even rows
  2537. * out[2][0], out[2][1] = i+1, j # UR
  2538. * out[3][0], out[3][1] = i+1, j-1 # DR # <<<<<<<<<<<<<<
  2539. * out[4][0], out[4][1] = i-1, j-1 # DL
  2540. * out[5][0], out[5][1] = i-1, j # UL
  2541. */
  2542. __pyx_t_2 = (__pyx_v_i + 1);
  2543. __pyx_t_16 = (__pyx_v_j - 1);
  2544. __pyx_t_17 = 3;
  2545. __pyx_t_18 = 0;
  2546. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_17 * __pyx_v_out.strides[0]) ) + __pyx_t_18 * __pyx_v_out.strides[1]) )) = __pyx_t_2;
  2547. __pyx_t_19 = 3;
  2548. __pyx_t_20 = 1;
  2549. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_19 * __pyx_v_out.strides[0]) ) + __pyx_t_20 * __pyx_v_out.strides[1]) )) = __pyx_t_16;
  2550. /* "app/trade/trade_utils.pyx":22
  2551. * out[2][0], out[2][1] = i+1, j # UR
  2552. * out[3][0], out[3][1] = i+1, j-1 # DR
  2553. * out[4][0], out[4][1] = i-1, j-1 # DL # <<<<<<<<<<<<<<
  2554. * out[5][0], out[5][1] = i-1, j # UL
  2555. * else: # odd rows
  2556. */
  2557. __pyx_t_16 = (__pyx_v_i - 1);
  2558. __pyx_t_2 = (__pyx_v_j - 1);
  2559. __pyx_t_21 = 4;
  2560. __pyx_t_22 = 0;
  2561. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_21 * __pyx_v_out.strides[0]) ) + __pyx_t_22 * __pyx_v_out.strides[1]) )) = __pyx_t_16;
  2562. __pyx_t_23 = 4;
  2563. __pyx_t_24 = 1;
  2564. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_23 * __pyx_v_out.strides[0]) ) + __pyx_t_24 * __pyx_v_out.strides[1]) )) = __pyx_t_2;
  2565. /* "app/trade/trade_utils.pyx":23
  2566. * out[3][0], out[3][1] = i+1, j-1 # DR
  2567. * out[4][0], out[4][1] = i-1, j-1 # DL
  2568. * out[5][0], out[5][1] = i-1, j # UL # <<<<<<<<<<<<<<
  2569. * else: # odd rows
  2570. * out[2][0], out[2][1] = i+1, j+1 # UR
  2571. */
  2572. __pyx_t_2 = (__pyx_v_i - 1);
  2573. __pyx_t_1 = __pyx_v_j;
  2574. __pyx_t_25 = 5;
  2575. __pyx_t_26 = 0;
  2576. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_25 * __pyx_v_out.strides[0]) ) + __pyx_t_26 * __pyx_v_out.strides[1]) )) = __pyx_t_2;
  2577. __pyx_t_27 = 5;
  2578. __pyx_t_28 = 1;
  2579. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_27 * __pyx_v_out.strides[0]) ) + __pyx_t_28 * __pyx_v_out.strides[1]) )) = __pyx_t_1;
  2580. /* "app/trade/trade_utils.pyx":19
  2581. * out[0][0], out[0][1] = i, j+1 # UU
  2582. * out[1][0], out[1][1] = i, j-1 # DD
  2583. * if i % 2 == 0: # even rows # <<<<<<<<<<<<<<
  2584. * out[2][0], out[2][1] = i+1, j # UR
  2585. * out[3][0], out[3][1] = i+1, j-1 # DR
  2586. */
  2587. goto __pyx_L3;
  2588. }
  2589. /* "app/trade/trade_utils.pyx":25
  2590. * out[5][0], out[5][1] = i-1, j # UL
  2591. * else: # odd rows
  2592. * out[2][0], out[2][1] = i+1, j+1 # UR # <<<<<<<<<<<<<<
  2593. * out[3][0], out[3][1] = i+1, j # DR
  2594. * out[4][0], out[4][1] = i-1, j # DL
  2595. */
  2596. /*else*/ {
  2597. __pyx_t_2 = (__pyx_v_i + 1);
  2598. __pyx_t_16 = (__pyx_v_j + 1);
  2599. __pyx_t_29 = 2;
  2600. __pyx_t_30 = 0;
  2601. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_29 * __pyx_v_out.strides[0]) ) + __pyx_t_30 * __pyx_v_out.strides[1]) )) = __pyx_t_2;
  2602. __pyx_t_31 = 2;
  2603. __pyx_t_32 = 1;
  2604. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_31 * __pyx_v_out.strides[0]) ) + __pyx_t_32 * __pyx_v_out.strides[1]) )) = __pyx_t_16;
  2605. /* "app/trade/trade_utils.pyx":26
  2606. * else: # odd rows
  2607. * out[2][0], out[2][1] = i+1, j+1 # UR
  2608. * out[3][0], out[3][1] = i+1, j # DR # <<<<<<<<<<<<<<
  2609. * out[4][0], out[4][1] = i-1, j # DL
  2610. * out[5][0], out[5][1] = i-1, j+1 # UL
  2611. */
  2612. __pyx_t_16 = (__pyx_v_i + 1);
  2613. __pyx_t_1 = __pyx_v_j;
  2614. __pyx_t_33 = 3;
  2615. __pyx_t_34 = 0;
  2616. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_33 * __pyx_v_out.strides[0]) ) + __pyx_t_34 * __pyx_v_out.strides[1]) )) = __pyx_t_16;
  2617. __pyx_t_35 = 3;
  2618. __pyx_t_36 = 1;
  2619. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_35 * __pyx_v_out.strides[0]) ) + __pyx_t_36 * __pyx_v_out.strides[1]) )) = __pyx_t_1;
  2620. /* "app/trade/trade_utils.pyx":27
  2621. * out[2][0], out[2][1] = i+1, j+1 # UR
  2622. * out[3][0], out[3][1] = i+1, j # DR
  2623. * out[4][0], out[4][1] = i-1, j # DL # <<<<<<<<<<<<<<
  2624. * out[5][0], out[5][1] = i-1, j+1 # UL
  2625. *
  2626. */
  2627. __pyx_t_16 = (__pyx_v_i - 1);
  2628. __pyx_t_1 = __pyx_v_j;
  2629. __pyx_t_37 = 4;
  2630. __pyx_t_38 = 0;
  2631. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_37 * __pyx_v_out.strides[0]) ) + __pyx_t_38 * __pyx_v_out.strides[1]) )) = __pyx_t_16;
  2632. __pyx_t_39 = 4;
  2633. __pyx_t_40 = 1;
  2634. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_39 * __pyx_v_out.strides[0]) ) + __pyx_t_40 * __pyx_v_out.strides[1]) )) = __pyx_t_1;
  2635. /* "app/trade/trade_utils.pyx":28
  2636. * out[3][0], out[3][1] = i+1, j # DR
  2637. * out[4][0], out[4][1] = i-1, j # DL
  2638. * out[5][0], out[5][1] = i-1, j+1 # UL # <<<<<<<<<<<<<<
  2639. *
  2640. * @cython.boundscheck(True)
  2641. */
  2642. __pyx_t_16 = (__pyx_v_i - 1);
  2643. __pyx_t_2 = (__pyx_v_j + 1);
  2644. __pyx_t_41 = 5;
  2645. __pyx_t_42 = 0;
  2646. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_41 * __pyx_v_out.strides[0]) ) + __pyx_t_42 * __pyx_v_out.strides[1]) )) = __pyx_t_16;
  2647. __pyx_t_43 = 5;
  2648. __pyx_t_44 = 1;
  2649. *((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_out.data + __pyx_t_43 * __pyx_v_out.strides[0]) ) + __pyx_t_44 * __pyx_v_out.strides[1]) )) = __pyx_t_2;
  2650. }
  2651. __pyx_L3:;
  2652. /* "app/trade/trade_utils.pyx":15
  2653. * @cython.boundscheck(False)
  2654. * @cython.wraparound(False)
  2655. * cdef hex_neighbors(const int i, const int j, int[:,:] out): # <<<<<<<<<<<<<<
  2656. * cdef int ii, jj
  2657. * out[0][0], out[0][1] = i, j+1 # UU
  2658. */
  2659. /* function exit code */
  2660. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  2661. __Pyx_XGIVEREF(__pyx_r);
  2662. __Pyx_RefNannyFinishContext();
  2663. return __pyx_r;
  2664. }
  2665. /* "app/trade/trade_utils.pyx":33
  2666. * @cython.wraparound(False)
  2667. * @cython.cdivision(True)
  2668. * cdef _trade_distance(int init_i, int init_j, float trade_range, const float[:, :] trade_traversal_cost, # <<<<<<<<<<<<<<
  2669. * const float[:, :] trade_value, float[:, :] distance):
  2670. * """
  2671. */
  2672. static PyObject *__pyx_f_3app_5trade_11trade_utils__trade_distance(int __pyx_v_init_i, int __pyx_v_init_j, float __pyx_v_trade_range, __Pyx_memviewslice __pyx_v_trade_traversal_cost, __Pyx_memviewslice __pyx_v_trade_value, __Pyx_memviewslice __pyx_v_distance) {
  2673. int __pyx_v_width;
  2674. int __pyx_v_height;
  2675. __pyx_t_3app_5trade_11trade_utils_pp_t __pyx_v_pp;
  2676. __pyx_t_3app_5trade_11trade_utils_step __pyx_v_top;
  2677. int __pyx_v_i;
  2678. int __pyx_v_j;
  2679. int __pyx_v_ii;
  2680. int __pyx_v_jj;
  2681. int __pyx_v_exp_i;
  2682. int __pyx_v_exp_j;
  2683. float __pyx_v_exp_val;
  2684. float __pyx_v_dist;
  2685. float __pyx_v_dist_tmp;
  2686. __Pyx_memviewslice __pyx_v_neighbors = { 0, 0, { 0 }, { 0 }, { 0 } };
  2687. __Pyx_memviewslice __pyx_v_visited = { 0, 0, { 0 }, { 0 }, { 0 } };
  2688. long __pyx_v_idx;
  2689. PyObject *__pyx_r = NULL;
  2690. __Pyx_RefNannyDeclarations
  2691. PyObject *__pyx_t_1 = NULL;
  2692. PyObject *__pyx_t_2 = NULL;
  2693. PyObject *__pyx_t_3 = NULL;
  2694. PyObject *__pyx_t_4 = NULL;
  2695. __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
  2696. PyObject *__pyx_t_6 = NULL;
  2697. __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  2698. Py_ssize_t __pyx_t_8;
  2699. Py_ssize_t __pyx_t_9;
  2700. int __pyx_t_10;
  2701. __pyx_t_3app_5trade_11trade_utils_step __pyx_t_11;
  2702. int __pyx_t_12;
  2703. Py_ssize_t __pyx_t_13;
  2704. Py_ssize_t __pyx_t_14;
  2705. int __pyx_t_15;
  2706. Py_ssize_t __pyx_t_16;
  2707. Py_ssize_t __pyx_t_17;
  2708. long __pyx_t_18;
  2709. Py_ssize_t __pyx_t_19;
  2710. Py_ssize_t __pyx_t_20;
  2711. Py_ssize_t __pyx_t_21;
  2712. Py_ssize_t __pyx_t_22;
  2713. int __pyx_t_23;
  2714. int __pyx_t_24;
  2715. Py_ssize_t __pyx_t_25;
  2716. Py_ssize_t __pyx_t_26;
  2717. Py_ssize_t __pyx_t_27;
  2718. Py_ssize_t __pyx_t_28;
  2719. Py_ssize_t __pyx_t_29;
  2720. Py_ssize_t __pyx_t_30;
  2721. Py_ssize_t __pyx_t_31;
  2722. Py_ssize_t __pyx_t_32;
  2723. __Pyx_RefNannySetupContext("_trade_distance", 0);
  2724. /* "app/trade/trade_utils.pyx":43
  2725. * """
  2726. *
  2727. * cdef int width = trade_traversal_cost.shape[0] # <<<<<<<<<<<<<<
  2728. * cdef int height = trade_traversal_cost.shape[1]
  2729. * cdef pp_t pp
  2730. */
  2731. __pyx_v_width = (__pyx_v_trade_traversal_cost.shape[0]);
  2732. /* "app/trade/trade_utils.pyx":44
  2733. *
  2734. * cdef int width = trade_traversal_cost.shape[0]
  2735. * cdef int height = trade_traversal_cost.shape[1] # <<<<<<<<<<<<<<
  2736. * cdef pp_t pp
  2737. * cdef step top
  2738. */
  2739. __pyx_v_height = (__pyx_v_trade_traversal_cost.shape[1]);
  2740. /* "app/trade/trade_utils.pyx":48
  2741. * cdef step top
  2742. * cdef int i, j, ii, jj
  2743. * cdef int exp_i = -1, exp_j = -1 # <<<<<<<<<<<<<<
  2744. * cdef float exp_val = 0
  2745. * cdef float dist, dist_tmp
  2746. */
  2747. __pyx_v_exp_i = -1;
  2748. __pyx_v_exp_j = -1;
  2749. /* "app/trade/trade_utils.pyx":49
  2750. * cdef int i, j, ii, jj
  2751. * cdef int exp_i = -1, exp_j = -1
  2752. * cdef float exp_val = 0 # <<<<<<<<<<<<<<
  2753. * cdef float dist, dist_tmp
  2754. * cdef int[:, :] neighbors = np.zeros((6,2), dtype=np.int32)
  2755. */
  2756. __pyx_v_exp_val = 0.0;
  2757. /* "app/trade/trade_utils.pyx":51
  2758. * cdef float exp_val = 0
  2759. * cdef float dist, dist_tmp
  2760. * cdef int[:, :] neighbors = np.zeros((6,2), dtype=np.int32) # <<<<<<<<<<<<<<
  2761. *
  2762. * cdef char[:, :] visited = np.full((trade_traversal_cost.shape[0], trade_traversal_cost.shape[1]),
  2763. */
  2764. __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  2765. __Pyx_GOTREF(__pyx_t_1);
  2766. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error)
  2767. __Pyx_GOTREF(__pyx_t_2);
  2768. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2769. __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 51, __pyx_L1_error)
  2770. __Pyx_GOTREF(__pyx_t_1);
  2771. __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error)
  2772. __Pyx_GOTREF(__pyx_t_3);
  2773. __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_int32); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error)
  2774. __Pyx_GOTREF(__pyx_t_4);
  2775. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2776. if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 51, __pyx_L1_error)
  2777. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2778. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__2, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 51, __pyx_L1_error)
  2779. __Pyx_GOTREF(__pyx_t_4);
  2780. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2781. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2782. __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_dsds_int(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 51, __pyx_L1_error)
  2783. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2784. __pyx_v_neighbors = __pyx_t_5;
  2785. __pyx_t_5.memview = NULL;
  2786. __pyx_t_5.data = NULL;
  2787. /* "app/trade/trade_utils.pyx":53
  2788. * cdef int[:, :] neighbors = np.zeros((6,2), dtype=np.int32)
  2789. *
  2790. * cdef char[:, :] visited = np.full((trade_traversal_cost.shape[0], trade_traversal_cost.shape[1]), # <<<<<<<<<<<<<<
  2791. * False, dtype=np.int8)
  2792. * distance[init_i][init_j] = 0.0
  2793. */
  2794. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error)
  2795. __Pyx_GOTREF(__pyx_t_4);
  2796. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_full); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error)
  2797. __Pyx_GOTREF(__pyx_t_1);
  2798. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2799. __pyx_t_4 = PyInt_FromSsize_t((__pyx_v_trade_traversal_cost.shape[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error)
  2800. __Pyx_GOTREF(__pyx_t_4);
  2801. __pyx_t_2 = PyInt_FromSsize_t((__pyx_v_trade_traversal_cost.shape[1])); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
  2802. __Pyx_GOTREF(__pyx_t_2);
  2803. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error)
  2804. __Pyx_GOTREF(__pyx_t_3);
  2805. __Pyx_GIVEREF(__pyx_t_4);
  2806. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  2807. __Pyx_GIVEREF(__pyx_t_2);
  2808. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  2809. __pyx_t_4 = 0;
  2810. __pyx_t_2 = 0;
  2811. /* "app/trade/trade_utils.pyx":54
  2812. *
  2813. * cdef char[:, :] visited = np.full((trade_traversal_cost.shape[0], trade_traversal_cost.shape[1]),
  2814. * False, dtype=np.int8) # <<<<<<<<<<<<<<
  2815. * distance[init_i][init_j] = 0.0
  2816. * pp.push(step(0.0, init_j*width+init_i))
  2817. */
  2818. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error)
  2819. __Pyx_GOTREF(__pyx_t_2);
  2820. __Pyx_GIVEREF(__pyx_t_3);
  2821. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  2822. __Pyx_INCREF(Py_False);
  2823. __Pyx_GIVEREF(Py_False);
  2824. PyTuple_SET_ITEM(__pyx_t_2, 1, Py_False);
  2825. __pyx_t_3 = 0;
  2826. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
  2827. __Pyx_GOTREF(__pyx_t_3);
  2828. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error)
  2829. __Pyx_GOTREF(__pyx_t_4);
  2830. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error)
  2831. __Pyx_GOTREF(__pyx_t_6);
  2832. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  2833. if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
  2834. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2835. /* "app/trade/trade_utils.pyx":53
  2836. * cdef int[:, :] neighbors = np.zeros((6,2), dtype=np.int32)
  2837. *
  2838. * cdef char[:, :] visited = np.full((trade_traversal_cost.shape[0], trade_traversal_cost.shape[1]), # <<<<<<<<<<<<<<
  2839. * False, dtype=np.int8)
  2840. * distance[init_i][init_j] = 0.0
  2841. */
  2842. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L1_error)
  2843. __Pyx_GOTREF(__pyx_t_6);
  2844. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  2845. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  2846. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  2847. __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_char(__pyx_t_6, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 53, __pyx_L1_error)
  2848. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  2849. __pyx_v_visited = __pyx_t_7;
  2850. __pyx_t_7.memview = NULL;
  2851. __pyx_t_7.data = NULL;
  2852. /* "app/trade/trade_utils.pyx":55
  2853. * cdef char[:, :] visited = np.full((trade_traversal_cost.shape[0], trade_traversal_cost.shape[1]),
  2854. * False, dtype=np.int8)
  2855. * distance[init_i][init_j] = 0.0 # <<<<<<<<<<<<<<
  2856. * pp.push(step(0.0, init_j*width+init_i))
  2857. *
  2858. */
  2859. __pyx_t_8 = __pyx_v_init_i;
  2860. __pyx_t_9 = __pyx_v_init_j;
  2861. __pyx_t_10 = -1;
  2862. if (__pyx_t_8 < 0) {
  2863. __pyx_t_10 = 0;
  2864. } else if (unlikely(__pyx_t_8 >= __pyx_v_distance.shape[0])) __pyx_t_10 = 0;
  2865. if (__pyx_t_9 < 0) {
  2866. __pyx_t_10 = 1;
  2867. } else if (unlikely(__pyx_t_9 >= __pyx_v_distance.shape[1])) __pyx_t_10 = 1;
  2868. if (unlikely(__pyx_t_10 != -1)) {
  2869. __Pyx_RaiseBufferIndexError(__pyx_t_10);
  2870. __PYX_ERR(0, 55, __pyx_L1_error)
  2871. }
  2872. *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distance.data + __pyx_t_8 * __pyx_v_distance.strides[0]) ) + __pyx_t_9 * __pyx_v_distance.strides[1]) )) = 0.0;
  2873. /* "app/trade/trade_utils.pyx":56
  2874. * False, dtype=np.int8)
  2875. * distance[init_i][init_j] = 0.0
  2876. * pp.push(step(0.0, init_j*width+init_i)) # <<<<<<<<<<<<<<
  2877. *
  2878. * while not pp.empty():
  2879. */
  2880. try {
  2881. __pyx_t_11 = __pyx_t_3app_5trade_11trade_utils_step(0.0, ((__pyx_v_init_j * __pyx_v_width) + __pyx_v_init_i));
  2882. } catch(...) {
  2883. __Pyx_CppExn2PyErr();
  2884. __PYX_ERR(0, 56, __pyx_L1_error)
  2885. }
  2886. __pyx_v_pp.push(__pyx_t_11);
  2887. /* "app/trade/trade_utils.pyx":58
  2888. * pp.push(step(0.0, init_j*width+init_i))
  2889. *
  2890. * while not pp.empty(): # <<<<<<<<<<<<<<
  2891. * top = pp.top()
  2892. * i = top.second % width
  2893. */
  2894. while (1) {
  2895. __pyx_t_12 = ((!(__pyx_v_pp.empty() != 0)) != 0);
  2896. if (!__pyx_t_12) break;
  2897. /* "app/trade/trade_utils.pyx":59
  2898. *
  2899. * while not pp.empty():
  2900. * top = pp.top() # <<<<<<<<<<<<<<
  2901. * i = top.second % width
  2902. * j = top.second // width
  2903. */
  2904. __pyx_v_top = __pyx_v_pp.top();
  2905. /* "app/trade/trade_utils.pyx":60
  2906. * while not pp.empty():
  2907. * top = pp.top()
  2908. * i = top.second % width # <<<<<<<<<<<<<<
  2909. * j = top.second // width
  2910. * dist = -top.first
  2911. */
  2912. __pyx_v_i = (__pyx_v_top.second % __pyx_v_width);
  2913. /* "app/trade/trade_utils.pyx":61
  2914. * top = pp.top()
  2915. * i = top.second % width
  2916. * j = top.second // width # <<<<<<<<<<<<<<
  2917. * dist = -top.first
  2918. * pp.pop()
  2919. */
  2920. __pyx_v_j = (__pyx_v_top.second / __pyx_v_width);
  2921. /* "app/trade/trade_utils.pyx":62
  2922. * i = top.second % width
  2923. * j = top.second // width
  2924. * dist = -top.first # <<<<<<<<<<<<<<
  2925. * pp.pop()
  2926. *
  2927. */
  2928. __pyx_v_dist = (-__pyx_v_top.first);
  2929. /* "app/trade/trade_utils.pyx":63
  2930. * j = top.second // width
  2931. * dist = -top.first
  2932. * pp.pop() # <<<<<<<<<<<<<<
  2933. *
  2934. * if trade_value[i][j] > exp_val:
  2935. */
  2936. __pyx_v_pp.pop();
  2937. /* "app/trade/trade_utils.pyx":65
  2938. * pp.pop()
  2939. *
  2940. * if trade_value[i][j] > exp_val: # <<<<<<<<<<<<<<
  2941. * exp_i, exp_j = i, j
  2942. * exp_val = trade_value[i][j]
  2943. */
  2944. __pyx_t_13 = __pyx_v_i;
  2945. __pyx_t_14 = __pyx_v_j;
  2946. __pyx_t_10 = -1;
  2947. if (__pyx_t_13 < 0) {
  2948. __pyx_t_10 = 0;
  2949. } else if (unlikely(__pyx_t_13 >= __pyx_v_trade_value.shape[0])) __pyx_t_10 = 0;
  2950. if (__pyx_t_14 < 0) {
  2951. __pyx_t_10 = 1;
  2952. } else if (unlikely(__pyx_t_14 >= __pyx_v_trade_value.shape[1])) __pyx_t_10 = 1;
  2953. if (unlikely(__pyx_t_10 != -1)) {
  2954. __Pyx_RaiseBufferIndexError(__pyx_t_10);
  2955. __PYX_ERR(0, 65, __pyx_L1_error)
  2956. }
  2957. __pyx_t_12 = (((*((float const *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_trade_value.data + __pyx_t_13 * __pyx_v_trade_value.strides[0]) ) + __pyx_t_14 * __pyx_v_trade_value.strides[1]) ))) > __pyx_v_exp_val) != 0);
  2958. if (__pyx_t_12) {
  2959. /* "app/trade/trade_utils.pyx":66
  2960. *
  2961. * if trade_value[i][j] > exp_val:
  2962. * exp_i, exp_j = i, j # <<<<<<<<<<<<<<
  2963. * exp_val = trade_value[i][j]
  2964. *
  2965. */
  2966. __pyx_t_10 = __pyx_v_i;
  2967. __pyx_t_15 = __pyx_v_j;
  2968. __pyx_v_exp_i = __pyx_t_10;
  2969. __pyx_v_exp_j = __pyx_t_15;
  2970. /* "app/trade/trade_utils.pyx":67
  2971. * if trade_value[i][j] > exp_val:
  2972. * exp_i, exp_j = i, j
  2973. * exp_val = trade_value[i][j] # <<<<<<<<<<<<<<
  2974. *
  2975. * hex_neighbors(i, j, neighbors)
  2976. */
  2977. __pyx_t_16 = __pyx_v_i;
  2978. __pyx_t_17 = __pyx_v_j;
  2979. __pyx_t_15 = -1;
  2980. if (__pyx_t_16 < 0) {
  2981. __pyx_t_15 = 0;
  2982. } else if (unlikely(__pyx_t_16 >= __pyx_v_trade_value.shape[0])) __pyx_t_15 = 0;
  2983. if (__pyx_t_17 < 0) {
  2984. __pyx_t_15 = 1;
  2985. } else if (unlikely(__pyx_t_17 >= __pyx_v_trade_value.shape[1])) __pyx_t_15 = 1;
  2986. if (unlikely(__pyx_t_15 != -1)) {
  2987. __Pyx_RaiseBufferIndexError(__pyx_t_15);
  2988. __PYX_ERR(0, 67, __pyx_L1_error)
  2989. }
  2990. __pyx_v_exp_val = (*((float const *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_trade_value.data + __pyx_t_16 * __pyx_v_trade_value.strides[0]) ) + __pyx_t_17 * __pyx_v_trade_value.strides[1]) )));
  2991. /* "app/trade/trade_utils.pyx":65
  2992. * pp.pop()
  2993. *
  2994. * if trade_value[i][j] > exp_val: # <<<<<<<<<<<<<<
  2995. * exp_i, exp_j = i, j
  2996. * exp_val = trade_value[i][j]
  2997. */
  2998. }
  2999. /* "app/trade/trade_utils.pyx":69
  3000. * exp_val = trade_value[i][j]
  3001. *
  3002. * hex_neighbors(i, j, neighbors) # <<<<<<<<<<<<<<
  3003. * for idx in range(6):
  3004. * ii = neighbors[idx][0]
  3005. */
  3006. __pyx_t_6 = __pyx_f_3app_5trade_11trade_utils_hex_neighbors(__pyx_v_i, __pyx_v_j, __pyx_v_neighbors); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L1_error)
  3007. __Pyx_GOTREF(__pyx_t_6);
  3008. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  3009. /* "app/trade/trade_utils.pyx":70
  3010. *
  3011. * hex_neighbors(i, j, neighbors)
  3012. * for idx in range(6): # <<<<<<<<<<<<<<
  3013. * ii = neighbors[idx][0]
  3014. * jj = neighbors[idx][1]
  3015. */
  3016. for (__pyx_t_18 = 0; __pyx_t_18 < 6; __pyx_t_18+=1) {
  3017. __pyx_v_idx = __pyx_t_18;
  3018. /* "app/trade/trade_utils.pyx":71
  3019. * hex_neighbors(i, j, neighbors)
  3020. * for idx in range(6):
  3021. * ii = neighbors[idx][0] # <<<<<<<<<<<<<<
  3022. * jj = neighbors[idx][1]
  3023. * if 0 <= ii < width and 0 <= jj < height and not visited[ii][jj]:
  3024. */
  3025. __pyx_t_19 = __pyx_v_idx;
  3026. __pyx_t_20 = 0;
  3027. __pyx_t_15 = -1;
  3028. if (__pyx_t_19 < 0) {
  3029. __pyx_t_15 = 0;
  3030. } else if (unlikely(__pyx_t_19 >= __pyx_v_neighbors.shape[0])) __pyx_t_15 = 0;
  3031. if (__pyx_t_20 < 0) {
  3032. __pyx_t_15 = 1;
  3033. } else if (unlikely(__pyx_t_20 >= __pyx_v_neighbors.shape[1])) __pyx_t_15 = 1;
  3034. if (unlikely(__pyx_t_15 != -1)) {
  3035. __Pyx_RaiseBufferIndexError(__pyx_t_15);
  3036. __PYX_ERR(0, 71, __pyx_L1_error)
  3037. }
  3038. __pyx_v_ii = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_neighbors.data + __pyx_t_19 * __pyx_v_neighbors.strides[0]) ) + __pyx_t_20 * __pyx_v_neighbors.strides[1]) )));
  3039. /* "app/trade/trade_utils.pyx":72
  3040. * for idx in range(6):
  3041. * ii = neighbors[idx][0]
  3042. * jj = neighbors[idx][1] # <<<<<<<<<<<<<<
  3043. * if 0 <= ii < width and 0 <= jj < height and not visited[ii][jj]:
  3044. * visited[ii][jj] = True
  3045. */
  3046. __pyx_t_21 = __pyx_v_idx;
  3047. __pyx_t_22 = 1;
  3048. __pyx_t_15 = -1;
  3049. if (__pyx_t_21 < 0) {
  3050. __pyx_t_15 = 0;
  3051. } else if (unlikely(__pyx_t_21 >= __pyx_v_neighbors.shape[0])) __pyx_t_15 = 0;
  3052. if (__pyx_t_22 < 0) {
  3053. __pyx_t_15 = 1;
  3054. } else if (unlikely(__pyx_t_22 >= __pyx_v_neighbors.shape[1])) __pyx_t_15 = 1;
  3055. if (unlikely(__pyx_t_15 != -1)) {
  3056. __Pyx_RaiseBufferIndexError(__pyx_t_15);
  3057. __PYX_ERR(0, 72, __pyx_L1_error)
  3058. }
  3059. __pyx_v_jj = (*((int *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_neighbors.data + __pyx_t_21 * __pyx_v_neighbors.strides[0]) ) + __pyx_t_22 * __pyx_v_neighbors.strides[1]) )));
  3060. /* "app/trade/trade_utils.pyx":73
  3061. * ii = neighbors[idx][0]
  3062. * jj = neighbors[idx][1]
  3063. * if 0 <= ii < width and 0 <= jj < height and not visited[ii][jj]: # <<<<<<<<<<<<<<
  3064. * visited[ii][jj] = True
  3065. * dist_tmp = dist + trade_traversal_cost[ii][jj]
  3066. */
  3067. __pyx_t_23 = (0 <= __pyx_v_ii);
  3068. if (__pyx_t_23) {
  3069. __pyx_t_23 = (__pyx_v_ii < __pyx_v_width);
  3070. }
  3071. __pyx_t_24 = (__pyx_t_23 != 0);
  3072. if (__pyx_t_24) {
  3073. } else {
  3074. __pyx_t_12 = __pyx_t_24;
  3075. goto __pyx_L9_bool_binop_done;
  3076. }
  3077. __pyx_t_24 = (0 <= __pyx_v_jj);
  3078. if (__pyx_t_24) {
  3079. __pyx_t_24 = (__pyx_v_jj < __pyx_v_height);
  3080. }
  3081. __pyx_t_23 = (__pyx_t_24 != 0);
  3082. if (__pyx_t_23) {
  3083. } else {
  3084. __pyx_t_12 = __pyx_t_23;
  3085. goto __pyx_L9_bool_binop_done;
  3086. }
  3087. __pyx_t_25 = __pyx_v_ii;
  3088. __pyx_t_26 = __pyx_v_jj;
  3089. __pyx_t_15 = -1;
  3090. if (__pyx_t_25 < 0) {
  3091. __pyx_t_15 = 0;
  3092. } else if (unlikely(__pyx_t_25 >= __pyx_v_visited.shape[0])) __pyx_t_15 = 0;
  3093. if (__pyx_t_26 < 0) {
  3094. __pyx_t_15 = 1;
  3095. } else if (unlikely(__pyx_t_26 >= __pyx_v_visited.shape[1])) __pyx_t_15 = 1;
  3096. if (unlikely(__pyx_t_15 != -1)) {
  3097. __Pyx_RaiseBufferIndexError(__pyx_t_15);
  3098. __PYX_ERR(0, 73, __pyx_L1_error)
  3099. }
  3100. __pyx_t_23 = ((!((*((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_visited.data + __pyx_t_25 * __pyx_v_visited.strides[0]) ) + __pyx_t_26 * __pyx_v_visited.strides[1]) ))) != 0)) != 0);
  3101. __pyx_t_12 = __pyx_t_23;
  3102. __pyx_L9_bool_binop_done:;
  3103. if (__pyx_t_12) {
  3104. /* "app/trade/trade_utils.pyx":74
  3105. * jj = neighbors[idx][1]
  3106. * if 0 <= ii < width and 0 <= jj < height and not visited[ii][jj]:
  3107. * visited[ii][jj] = True # <<<<<<<<<<<<<<
  3108. * dist_tmp = dist + trade_traversal_cost[ii][jj]
  3109. *
  3110. */
  3111. __pyx_t_27 = __pyx_v_ii;
  3112. __pyx_t_28 = __pyx_v_jj;
  3113. __pyx_t_15 = -1;
  3114. if (__pyx_t_27 < 0) {
  3115. __pyx_t_15 = 0;
  3116. } else if (unlikely(__pyx_t_27 >= __pyx_v_visited.shape[0])) __pyx_t_15 = 0;
  3117. if (__pyx_t_28 < 0) {
  3118. __pyx_t_15 = 1;
  3119. } else if (unlikely(__pyx_t_28 >= __pyx_v_visited.shape[1])) __pyx_t_15 = 1;
  3120. if (unlikely(__pyx_t_15 != -1)) {
  3121. __Pyx_RaiseBufferIndexError(__pyx_t_15);
  3122. __PYX_ERR(0, 74, __pyx_L1_error)
  3123. }
  3124. *((char *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_visited.data + __pyx_t_27 * __pyx_v_visited.strides[0]) ) + __pyx_t_28 * __pyx_v_visited.strides[1]) )) = 1;
  3125. /* "app/trade/trade_utils.pyx":75
  3126. * if 0 <= ii < width and 0 <= jj < height and not visited[ii][jj]:
  3127. * visited[ii][jj] = True
  3128. * dist_tmp = dist + trade_traversal_cost[ii][jj] # <<<<<<<<<<<<<<
  3129. *
  3130. * if dist_tmp <= trade_range:
  3131. */
  3132. __pyx_t_29 = __pyx_v_ii;
  3133. __pyx_t_30 = __pyx_v_jj;
  3134. __pyx_t_15 = -1;
  3135. if (__pyx_t_29 < 0) {
  3136. __pyx_t_15 = 0;
  3137. } else if (unlikely(__pyx_t_29 >= __pyx_v_trade_traversal_cost.shape[0])) __pyx_t_15 = 0;
  3138. if (__pyx_t_30 < 0) {
  3139. __pyx_t_15 = 1;
  3140. } else if (unlikely(__pyx_t_30 >= __pyx_v_trade_traversal_cost.shape[1])) __pyx_t_15 = 1;
  3141. if (unlikely(__pyx_t_15 != -1)) {
  3142. __Pyx_RaiseBufferIndexError(__pyx_t_15);
  3143. __PYX_ERR(0, 75, __pyx_L1_error)
  3144. }
  3145. __pyx_v_dist_tmp = (__pyx_v_dist + (*((float const *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_trade_traversal_cost.data + __pyx_t_29 * __pyx_v_trade_traversal_cost.strides[0]) ) + __pyx_t_30 * __pyx_v_trade_traversal_cost.strides[1]) ))));
  3146. /* "app/trade/trade_utils.pyx":77
  3147. * dist_tmp = dist + trade_traversal_cost[ii][jj]
  3148. *
  3149. * if dist_tmp <= trade_range: # <<<<<<<<<<<<<<
  3150. * distance[ii][jj] = dist_tmp
  3151. * pp.push(step(-dist_tmp, jj*width+ii))
  3152. */
  3153. __pyx_t_12 = ((__pyx_v_dist_tmp <= __pyx_v_trade_range) != 0);
  3154. if (__pyx_t_12) {
  3155. /* "app/trade/trade_utils.pyx":78
  3156. *
  3157. * if dist_tmp <= trade_range:
  3158. * distance[ii][jj] = dist_tmp # <<<<<<<<<<<<<<
  3159. * pp.push(step(-dist_tmp, jj*width+ii))
  3160. * return exp_i, exp_j
  3161. */
  3162. __pyx_t_31 = __pyx_v_ii;
  3163. __pyx_t_32 = __pyx_v_jj;
  3164. __pyx_t_15 = -1;
  3165. if (__pyx_t_31 < 0) {
  3166. __pyx_t_15 = 0;
  3167. } else if (unlikely(__pyx_t_31 >= __pyx_v_distance.shape[0])) __pyx_t_15 = 0;
  3168. if (__pyx_t_32 < 0) {
  3169. __pyx_t_15 = 1;
  3170. } else if (unlikely(__pyx_t_32 >= __pyx_v_distance.shape[1])) __pyx_t_15 = 1;
  3171. if (unlikely(__pyx_t_15 != -1)) {
  3172. __Pyx_RaiseBufferIndexError(__pyx_t_15);
  3173. __PYX_ERR(0, 78, __pyx_L1_error)
  3174. }
  3175. *((float *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_distance.data + __pyx_t_31 * __pyx_v_distance.strides[0]) ) + __pyx_t_32 * __pyx_v_distance.strides[1]) )) = __pyx_v_dist_tmp;
  3176. /* "app/trade/trade_utils.pyx":79
  3177. * if dist_tmp <= trade_range:
  3178. * distance[ii][jj] = dist_tmp
  3179. * pp.push(step(-dist_tmp, jj*width+ii)) # <<<<<<<<<<<<<<
  3180. * return exp_i, exp_j
  3181. *
  3182. */
  3183. try {
  3184. __pyx_t_11 = __pyx_t_3app_5trade_11trade_utils_step((-__pyx_v_dist_tmp), ((__pyx_v_jj * __pyx_v_width) + __pyx_v_ii));
  3185. } catch(...) {
  3186. __Pyx_CppExn2PyErr();
  3187. __PYX_ERR(0, 79, __pyx_L1_error)
  3188. }
  3189. __pyx_v_pp.push(__pyx_t_11);
  3190. /* "app/trade/trade_utils.pyx":77
  3191. * dist_tmp = dist + trade_traversal_cost[ii][jj]
  3192. *
  3193. * if dist_tmp <= trade_range: # <<<<<<<<<<<<<<
  3194. * distance[ii][jj] = dist_tmp
  3195. * pp.push(step(-dist_tmp, jj*width+ii))
  3196. */
  3197. }
  3198. /* "app/trade/trade_utils.pyx":73
  3199. * ii = neighbors[idx][0]
  3200. * jj = neighbors[idx][1]
  3201. * if 0 <= ii < width and 0 <= jj < height and not visited[ii][jj]: # <<<<<<<<<<<<<<
  3202. * visited[ii][jj] = True
  3203. * dist_tmp = dist + trade_traversal_cost[ii][jj]
  3204. */
  3205. }
  3206. }
  3207. }
  3208. /* "app/trade/trade_utils.pyx":80
  3209. * distance[ii][jj] = dist_tmp
  3210. * pp.push(step(-dist_tmp, jj*width+ii))
  3211. * return exp_i, exp_j # <<<<<<<<<<<<<<
  3212. *
  3213. *
  3214. */
  3215. __Pyx_XDECREF(__pyx_r);
  3216. __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_exp_i); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 80, __pyx_L1_error)
  3217. __Pyx_GOTREF(__pyx_t_6);
  3218. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_exp_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error)
  3219. __Pyx_GOTREF(__pyx_t_3);
  3220. __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error)
  3221. __Pyx_GOTREF(__pyx_t_2);
  3222. __Pyx_GIVEREF(__pyx_t_6);
  3223. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6);
  3224. __Pyx_GIVEREF(__pyx_t_3);
  3225. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  3226. __pyx_t_6 = 0;
  3227. __pyx_t_3 = 0;
  3228. __pyx_r = __pyx_t_2;
  3229. __pyx_t_2 = 0;
  3230. goto __pyx_L0;
  3231. /* "app/trade/trade_utils.pyx":33
  3232. * @cython.wraparound(False)
  3233. * @cython.cdivision(True)
  3234. * cdef _trade_distance(int init_i, int init_j, float trade_range, const float[:, :] trade_traversal_cost, # <<<<<<<<<<<<<<
  3235. * const float[:, :] trade_value, float[:, :] distance):
  3236. * """
  3237. */
  3238. /* function exit code */
  3239. __pyx_L1_error:;
  3240. __Pyx_XDECREF(__pyx_t_1);
  3241. __Pyx_XDECREF(__pyx_t_2);
  3242. __Pyx_XDECREF(__pyx_t_3);
  3243. __Pyx_XDECREF(__pyx_t_4);
  3244. __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
  3245. __Pyx_XDECREF(__pyx_t_6);
  3246. __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  3247. __Pyx_AddTraceback("app.trade.trade_utils._trade_distance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3248. __pyx_r = 0;
  3249. __pyx_L0:;
  3250. __PYX_XDEC_MEMVIEW(&__pyx_v_neighbors, 1);
  3251. __PYX_XDEC_MEMVIEW(&__pyx_v_visited, 1);
  3252. __Pyx_XGIVEREF(__pyx_r);
  3253. __Pyx_RefNannyFinishContext();
  3254. return __pyx_r;
  3255. }
  3256. /* "app/trade/trade_utils.pyx":83
  3257. *
  3258. *
  3259. * def trade_distance(int i, int j, float trade_range, trade_traversal_cost: np.ndarray, trade_value: np.ndarray): # <<<<<<<<<<<<<<
  3260. * distance = np.full_like(trade_traversal_cost, -1)
  3261. * exp = _trade_distance(i, j, trade_range, trade_traversal_cost, trade_value, distance)
  3262. */
  3263. /* Python wrapper */
  3264. static PyObject *__pyx_pw_3app_5trade_11trade_utils_1trade_distance(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3265. static PyMethodDef __pyx_mdef_3app_5trade_11trade_utils_1trade_distance = {"trade_distance", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3app_5trade_11trade_utils_1trade_distance, METH_VARARGS|METH_KEYWORDS, 0};
  3266. static PyObject *__pyx_pw_3app_5trade_11trade_utils_1trade_distance(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3267. int __pyx_v_i;
  3268. int __pyx_v_j;
  3269. float __pyx_v_trade_range;
  3270. PyArrayObject *__pyx_v_trade_traversal_cost = 0;
  3271. PyArrayObject *__pyx_v_trade_value = 0;
  3272. PyObject *__pyx_r = 0;
  3273. __Pyx_RefNannyDeclarations
  3274. __Pyx_RefNannySetupContext("trade_distance (wrapper)", 0);
  3275. {
  3276. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_i,&__pyx_n_s_j,&__pyx_n_s_trade_range,&__pyx_n_s_trade_traversal_cost,&__pyx_n_s_trade_value,0};
  3277. PyObject* values[5] = {0,0,0,0,0};
  3278. if (unlikely(__pyx_kwds)) {
  3279. Py_ssize_t kw_args;
  3280. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3281. switch (pos_args) {
  3282. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3283. CYTHON_FALLTHROUGH;
  3284. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3285. CYTHON_FALLTHROUGH;
  3286. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3287. CYTHON_FALLTHROUGH;
  3288. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3289. CYTHON_FALLTHROUGH;
  3290. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3291. CYTHON_FALLTHROUGH;
  3292. case 0: break;
  3293. default: goto __pyx_L5_argtuple_error;
  3294. }
  3295. kw_args = PyDict_Size(__pyx_kwds);
  3296. switch (pos_args) {
  3297. case 0:
  3298. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--;
  3299. else goto __pyx_L5_argtuple_error;
  3300. CYTHON_FALLTHROUGH;
  3301. case 1:
  3302. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--;
  3303. else {
  3304. __Pyx_RaiseArgtupleInvalid("trade_distance", 1, 5, 5, 1); __PYX_ERR(0, 83, __pyx_L3_error)
  3305. }
  3306. CYTHON_FALLTHROUGH;
  3307. case 2:
  3308. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trade_range)) != 0)) kw_args--;
  3309. else {
  3310. __Pyx_RaiseArgtupleInvalid("trade_distance", 1, 5, 5, 2); __PYX_ERR(0, 83, __pyx_L3_error)
  3311. }
  3312. CYTHON_FALLTHROUGH;
  3313. case 3:
  3314. if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trade_traversal_cost)) != 0)) kw_args--;
  3315. else {
  3316. __Pyx_RaiseArgtupleInvalid("trade_distance", 1, 5, 5, 3); __PYX_ERR(0, 83, __pyx_L3_error)
  3317. }
  3318. CYTHON_FALLTHROUGH;
  3319. case 4:
  3320. if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trade_value)) != 0)) kw_args--;
  3321. else {
  3322. __Pyx_RaiseArgtupleInvalid("trade_distance", 1, 5, 5, 4); __PYX_ERR(0, 83, __pyx_L3_error)
  3323. }
  3324. }
  3325. if (unlikely(kw_args > 0)) {
  3326. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "trade_distance") < 0)) __PYX_ERR(0, 83, __pyx_L3_error)
  3327. }
  3328. } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
  3329. goto __pyx_L5_argtuple_error;
  3330. } else {
  3331. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3332. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3333. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3334. values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3335. values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  3336. }
  3337. __pyx_v_i = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L3_error)
  3338. __pyx_v_j = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_j == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L3_error)
  3339. __pyx_v_trade_range = __pyx_PyFloat_AsFloat(values[2]); if (unlikely((__pyx_v_trade_range == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L3_error)
  3340. __pyx_v_trade_traversal_cost = ((PyArrayObject *)values[3]);
  3341. __pyx_v_trade_value = ((PyArrayObject *)values[4]);
  3342. }
  3343. goto __pyx_L4_argument_unpacking_done;
  3344. __pyx_L5_argtuple_error:;
  3345. __Pyx_RaiseArgtupleInvalid("trade_distance", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 83, __pyx_L3_error)
  3346. __pyx_L3_error:;
  3347. __Pyx_AddTraceback("app.trade.trade_utils.trade_distance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3348. __Pyx_RefNannyFinishContext();
  3349. return NULL;
  3350. __pyx_L4_argument_unpacking_done:;
  3351. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trade_traversal_cost), __pyx_ptype_5numpy_ndarray, 1, "trade_traversal_cost", 0))) __PYX_ERR(0, 83, __pyx_L1_error)
  3352. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trade_value), __pyx_ptype_5numpy_ndarray, 1, "trade_value", 0))) __PYX_ERR(0, 83, __pyx_L1_error)
  3353. __pyx_r = __pyx_pf_3app_5trade_11trade_utils_trade_distance(__pyx_self, __pyx_v_i, __pyx_v_j, __pyx_v_trade_range, __pyx_v_trade_traversal_cost, __pyx_v_trade_value);
  3354. /* function exit code */
  3355. goto __pyx_L0;
  3356. __pyx_L1_error:;
  3357. __pyx_r = NULL;
  3358. __pyx_L0:;
  3359. __Pyx_RefNannyFinishContext();
  3360. return __pyx_r;
  3361. }
  3362. static PyObject *__pyx_pf_3app_5trade_11trade_utils_trade_distance(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_i, int __pyx_v_j, float __pyx_v_trade_range, PyArrayObject *__pyx_v_trade_traversal_cost, PyArrayObject *__pyx_v_trade_value) {
  3363. PyObject *__pyx_v_distance = NULL;
  3364. PyObject *__pyx_v_exp = NULL;
  3365. PyObject *__pyx_r = NULL;
  3366. __Pyx_RefNannyDeclarations
  3367. PyObject *__pyx_t_1 = NULL;
  3368. PyObject *__pyx_t_2 = NULL;
  3369. PyObject *__pyx_t_3 = NULL;
  3370. int __pyx_t_4;
  3371. PyObject *__pyx_t_5 = NULL;
  3372. __Pyx_memviewslice __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
  3373. __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
  3374. __Pyx_memviewslice __pyx_t_8 = { 0, 0, { 0 }, { 0 }, { 0 } };
  3375. __Pyx_RefNannySetupContext("trade_distance", 0);
  3376. /* "app/trade/trade_utils.pyx":84
  3377. *
  3378. * def trade_distance(int i, int j, float trade_range, trade_traversal_cost: np.ndarray, trade_value: np.ndarray):
  3379. * distance = np.full_like(trade_traversal_cost, -1) # <<<<<<<<<<<<<<
  3380. * exp = _trade_distance(i, j, trade_range, trade_traversal_cost, trade_value, distance)
  3381. * return exp, distance
  3382. */
  3383. __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
  3384. __Pyx_GOTREF(__pyx_t_2);
  3385. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_full_like); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
  3386. __Pyx_GOTREF(__pyx_t_3);
  3387. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  3388. __pyx_t_2 = NULL;
  3389. __pyx_t_4 = 0;
  3390. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  3391. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  3392. if (likely(__pyx_t_2)) {
  3393. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  3394. __Pyx_INCREF(__pyx_t_2);
  3395. __Pyx_INCREF(function);
  3396. __Pyx_DECREF_SET(__pyx_t_3, function);
  3397. __pyx_t_4 = 1;
  3398. }
  3399. }
  3400. #if CYTHON_FAST_PYCALL
  3401. if (PyFunction_Check(__pyx_t_3)) {
  3402. PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_trade_traversal_cost), __pyx_int_neg_1};
  3403. __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
  3404. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3405. __Pyx_GOTREF(__pyx_t_1);
  3406. } else
  3407. #endif
  3408. #if CYTHON_FAST_PYCCALL
  3409. if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
  3410. PyObject *__pyx_temp[3] = {__pyx_t_2, ((PyObject *)__pyx_v_trade_traversal_cost), __pyx_int_neg_1};
  3411. __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
  3412. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  3413. __Pyx_GOTREF(__pyx_t_1);
  3414. } else
  3415. #endif
  3416. {
  3417. __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 84, __pyx_L1_error)
  3418. __Pyx_GOTREF(__pyx_t_5);
  3419. if (__pyx_t_2) {
  3420. __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL;
  3421. }
  3422. __Pyx_INCREF(((PyObject *)__pyx_v_trade_traversal_cost));
  3423. __Pyx_GIVEREF(((PyObject *)__pyx_v_trade_traversal_cost));
  3424. PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, ((PyObject *)__pyx_v_trade_traversal_cost));
  3425. __Pyx_INCREF(__pyx_int_neg_1);
  3426. __Pyx_GIVEREF(__pyx_int_neg_1);
  3427. PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_int_neg_1);
  3428. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
  3429. __Pyx_GOTREF(__pyx_t_1);
  3430. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  3431. }
  3432. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  3433. __pyx_v_distance = __pyx_t_1;
  3434. __pyx_t_1 = 0;
  3435. /* "app/trade/trade_utils.pyx":85
  3436. * def trade_distance(int i, int j, float trade_range, trade_traversal_cost: np.ndarray, trade_value: np.ndarray):
  3437. * distance = np.full_like(trade_traversal_cost, -1)
  3438. * exp = _trade_distance(i, j, trade_range, trade_traversal_cost, trade_value, distance) # <<<<<<<<<<<<<<
  3439. * return exp, distance
  3440. *
  3441. */
  3442. __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float__const__(((PyObject *)__pyx_v_trade_traversal_cost), 0); if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 85, __pyx_L1_error)
  3443. __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float__const__(((PyObject *)__pyx_v_trade_value), 0); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 85, __pyx_L1_error)
  3444. __pyx_t_8 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_v_distance, PyBUF_WRITABLE); if (unlikely(!__pyx_t_8.memview)) __PYX_ERR(0, 85, __pyx_L1_error)
  3445. __pyx_t_1 = __pyx_f_3app_5trade_11trade_utils__trade_distance(__pyx_v_i, __pyx_v_j, __pyx_v_trade_range, __pyx_t_6, __pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error)
  3446. __Pyx_GOTREF(__pyx_t_1);
  3447. __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  3448. __pyx_t_6.memview = NULL;
  3449. __pyx_t_6.data = NULL;
  3450. __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  3451. __pyx_t_7.memview = NULL;
  3452. __pyx_t_7.data = NULL;
  3453. __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  3454. __pyx_t_8.memview = NULL;
  3455. __pyx_t_8.data = NULL;
  3456. __pyx_v_exp = __pyx_t_1;
  3457. __pyx_t_1 = 0;
  3458. /* "app/trade/trade_utils.pyx":86
  3459. * distance = np.full_like(trade_traversal_cost, -1)
  3460. * exp = _trade_distance(i, j, trade_range, trade_traversal_cost, trade_value, distance)
  3461. * return exp, distance # <<<<<<<<<<<<<<
  3462. *
  3463. * cpdef update_export_partner(trade_range: np.ndarray, trade_distance: np.ndarray, trade_value: np.ndarray, export_partner: np.ndarray):
  3464. */
  3465. __Pyx_XDECREF(__pyx_r);
  3466. __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 86, __pyx_L1_error)
  3467. __Pyx_GOTREF(__pyx_t_1);
  3468. __Pyx_INCREF(__pyx_v_exp);
  3469. __Pyx_GIVEREF(__pyx_v_exp);
  3470. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_exp);
  3471. __Pyx_INCREF(__pyx_v_distance);
  3472. __Pyx_GIVEREF(__pyx_v_distance);
  3473. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_distance);
  3474. __pyx_r = __pyx_t_1;
  3475. __pyx_t_1 = 0;
  3476. goto __pyx_L0;
  3477. /* "app/trade/trade_utils.pyx":83
  3478. *
  3479. *
  3480. * def trade_distance(int i, int j, float trade_range, trade_traversal_cost: np.ndarray, trade_value: np.ndarray): # <<<<<<<<<<<<<<
  3481. * distance = np.full_like(trade_traversal_cost, -1)
  3482. * exp = _trade_distance(i, j, trade_range, trade_traversal_cost, trade_value, distance)
  3483. */
  3484. /* function exit code */
  3485. __pyx_L1_error:;
  3486. __Pyx_XDECREF(__pyx_t_1);
  3487. __Pyx_XDECREF(__pyx_t_2);
  3488. __Pyx_XDECREF(__pyx_t_3);
  3489. __Pyx_XDECREF(__pyx_t_5);
  3490. __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
  3491. __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
  3492. __PYX_XDEC_MEMVIEW(&__pyx_t_8, 1);
  3493. __Pyx_AddTraceback("app.trade.trade_utils.trade_distance", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3494. __pyx_r = NULL;
  3495. __pyx_L0:;
  3496. __Pyx_XDECREF(__pyx_v_distance);
  3497. __Pyx_XDECREF(__pyx_v_exp);
  3498. __Pyx_XGIVEREF(__pyx_r);
  3499. __Pyx_RefNannyFinishContext();
  3500. return __pyx_r;
  3501. }
  3502. /* "app/trade/trade_utils.pyx":88
  3503. * return exp, distance
  3504. *
  3505. * cpdef update_export_partner(trade_range: np.ndarray, trade_distance: np.ndarray, trade_value: np.ndarray, export_partner: np.ndarray): # <<<<<<<<<<<<<<
  3506. * cdef int width = trade_range.shape[0]
  3507. * cdef int height = trade_range.shape[1]
  3508. */
  3509. static PyObject *__pyx_pw_3app_5trade_11trade_utils_3update_export_partner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3510. static PyObject *__pyx_f_3app_5trade_11trade_utils_update_export_partner(PyArrayObject *__pyx_v_trade_range, PyArrayObject *__pyx_v_trade_distance, PyArrayObject *__pyx_v_trade_value, PyArrayObject *__pyx_v_export_partner, CYTHON_UNUSED int __pyx_skip_dispatch) {
  3511. int __pyx_v_width;
  3512. int __pyx_v_height;
  3513. __Pyx_memviewslice __pyx_v_distance = { 0, 0, { 0 }, { 0 }, { 0 } };
  3514. int __pyx_v_i;
  3515. int __pyx_v_j;
  3516. PyObject *__pyx_v_exp_i = NULL;
  3517. PyObject *__pyx_v_exp_j = NULL;
  3518. PyObject *__pyx_r = NULL;
  3519. __Pyx_RefNannyDeclarations
  3520. int __pyx_t_1;
  3521. int __pyx_t_2;
  3522. int __pyx_t_3;
  3523. int __pyx_t_4;
  3524. int __pyx_t_5;
  3525. int __pyx_t_6;
  3526. PyObject *__pyx_t_7 = NULL;
  3527. PyObject *__pyx_t_8 = NULL;
  3528. PyObject *__pyx_t_9 = NULL;
  3529. int __pyx_t_10;
  3530. PyObject *__pyx_t_11 = NULL;
  3531. __Pyx_memviewslice __pyx_t_12 = { 0, 0, { 0 }, { 0 }, { 0 } };
  3532. float __pyx_t_13;
  3533. __Pyx_memviewslice __pyx_t_14 = { 0, 0, { 0 }, { 0 }, { 0 } };
  3534. __Pyx_memviewslice __pyx_t_15 = { 0, 0, { 0 }, { 0 }, { 0 } };
  3535. PyObject *(*__pyx_t_16)(PyObject *);
  3536. __Pyx_RefNannySetupContext("update_export_partner", 0);
  3537. /* "app/trade/trade_utils.pyx":89
  3538. *
  3539. * cpdef update_export_partner(trade_range: np.ndarray, trade_distance: np.ndarray, trade_value: np.ndarray, export_partner: np.ndarray):
  3540. * cdef int width = trade_range.shape[0] # <<<<<<<<<<<<<<
  3541. * cdef int height = trade_range.shape[1]
  3542. *
  3543. */
  3544. __pyx_v_width = (__pyx_v_trade_range->dimensions[0]);
  3545. /* "app/trade/trade_utils.pyx":90
  3546. * cpdef update_export_partner(trade_range: np.ndarray, trade_distance: np.ndarray, trade_value: np.ndarray, export_partner: np.ndarray):
  3547. * cdef int width = trade_range.shape[0]
  3548. * cdef int height = trade_range.shape[1] # <<<<<<<<<<<<<<
  3549. *
  3550. * cdef float[:, :] distance
  3551. */
  3552. __pyx_v_height = (__pyx_v_trade_range->dimensions[1]);
  3553. /* "app/trade/trade_utils.pyx":93
  3554. *
  3555. * cdef float[:, :] distance
  3556. * for i in range(width): # <<<<<<<<<<<<<<
  3557. * for j in range(height):
  3558. * distance = np.full_like(trade_range, -1)
  3559. */
  3560. __pyx_t_1 = __pyx_v_width;
  3561. __pyx_t_2 = __pyx_t_1;
  3562. for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
  3563. __pyx_v_i = __pyx_t_3;
  3564. /* "app/trade/trade_utils.pyx":94
  3565. * cdef float[:, :] distance
  3566. * for i in range(width):
  3567. * for j in range(height): # <<<<<<<<<<<<<<
  3568. * distance = np.full_like(trade_range, -1)
  3569. * (exp_i, exp_j) = _trade_distance(i, j, trade_range[i, j], trade_distance, trade_value, distance)
  3570. */
  3571. __pyx_t_4 = __pyx_v_height;
  3572. __pyx_t_5 = __pyx_t_4;
  3573. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  3574. __pyx_v_j = __pyx_t_6;
  3575. /* "app/trade/trade_utils.pyx":95
  3576. * for i in range(width):
  3577. * for j in range(height):
  3578. * distance = np.full_like(trade_range, -1) # <<<<<<<<<<<<<<
  3579. * (exp_i, exp_j) = _trade_distance(i, j, trade_range[i, j], trade_distance, trade_value, distance)
  3580. * export_partner[i, j] = [exp_i, exp_j]
  3581. */
  3582. __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 95, __pyx_L1_error)
  3583. __Pyx_GOTREF(__pyx_t_8);
  3584. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_full_like); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 95, __pyx_L1_error)
  3585. __Pyx_GOTREF(__pyx_t_9);
  3586. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3587. __pyx_t_8 = NULL;
  3588. __pyx_t_10 = 0;
  3589. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) {
  3590. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
  3591. if (likely(__pyx_t_8)) {
  3592. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
  3593. __Pyx_INCREF(__pyx_t_8);
  3594. __Pyx_INCREF(function);
  3595. __Pyx_DECREF_SET(__pyx_t_9, function);
  3596. __pyx_t_10 = 1;
  3597. }
  3598. }
  3599. #if CYTHON_FAST_PYCALL
  3600. if (PyFunction_Check(__pyx_t_9)) {
  3601. PyObject *__pyx_temp[3] = {__pyx_t_8, ((PyObject *)__pyx_v_trade_range), __pyx_int_neg_1};
  3602. __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 95, __pyx_L1_error)
  3603. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  3604. __Pyx_GOTREF(__pyx_t_7);
  3605. } else
  3606. #endif
  3607. #if CYTHON_FAST_PYCCALL
  3608. if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) {
  3609. PyObject *__pyx_temp[3] = {__pyx_t_8, ((PyObject *)__pyx_v_trade_range), __pyx_int_neg_1};
  3610. __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_10, 2+__pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 95, __pyx_L1_error)
  3611. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  3612. __Pyx_GOTREF(__pyx_t_7);
  3613. } else
  3614. #endif
  3615. {
  3616. __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 95, __pyx_L1_error)
  3617. __Pyx_GOTREF(__pyx_t_11);
  3618. if (__pyx_t_8) {
  3619. __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); __pyx_t_8 = NULL;
  3620. }
  3621. __Pyx_INCREF(((PyObject *)__pyx_v_trade_range));
  3622. __Pyx_GIVEREF(((PyObject *)__pyx_v_trade_range));
  3623. PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, ((PyObject *)__pyx_v_trade_range));
  3624. __Pyx_INCREF(__pyx_int_neg_1);
  3625. __Pyx_GIVEREF(__pyx_int_neg_1);
  3626. PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_int_neg_1);
  3627. __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 95, __pyx_L1_error)
  3628. __Pyx_GOTREF(__pyx_t_7);
  3629. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3630. }
  3631. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  3632. __pyx_t_12 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float(__pyx_t_7, PyBUF_WRITABLE); if (unlikely(!__pyx_t_12.memview)) __PYX_ERR(0, 95, __pyx_L1_error)
  3633. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  3634. __PYX_XDEC_MEMVIEW(&__pyx_v_distance, 1);
  3635. __pyx_v_distance = __pyx_t_12;
  3636. __pyx_t_12.memview = NULL;
  3637. __pyx_t_12.data = NULL;
  3638. /* "app/trade/trade_utils.pyx":96
  3639. * for j in range(height):
  3640. * distance = np.full_like(trade_range, -1)
  3641. * (exp_i, exp_j) = _trade_distance(i, j, trade_range[i, j], trade_distance, trade_value, distance) # <<<<<<<<<<<<<<
  3642. * export_partner[i, j] = [exp_i, exp_j]
  3643. *
  3644. */
  3645. __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
  3646. __Pyx_GOTREF(__pyx_t_7);
  3647. __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error)
  3648. __Pyx_GOTREF(__pyx_t_9);
  3649. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 96, __pyx_L1_error)
  3650. __Pyx_GOTREF(__pyx_t_11);
  3651. __Pyx_GIVEREF(__pyx_t_7);
  3652. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7);
  3653. __Pyx_GIVEREF(__pyx_t_9);
  3654. PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_9);
  3655. __pyx_t_7 = 0;
  3656. __pyx_t_9 = 0;
  3657. __pyx_t_9 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_trade_range), __pyx_t_11); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error)
  3658. __Pyx_GOTREF(__pyx_t_9);
  3659. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  3660. __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_t_9); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 96, __pyx_L1_error)
  3661. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  3662. __pyx_t_14 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float__const__(((PyObject *)__pyx_v_trade_distance), 0); if (unlikely(!__pyx_t_14.memview)) __PYX_ERR(0, 96, __pyx_L1_error)
  3663. __pyx_t_15 = __Pyx_PyObject_to_MemoryviewSlice_dsds_float__const__(((PyObject *)__pyx_v_trade_value), 0); if (unlikely(!__pyx_t_15.memview)) __PYX_ERR(0, 96, __pyx_L1_error)
  3664. __pyx_t_9 = __pyx_f_3app_5trade_11trade_utils__trade_distance(__pyx_v_i, __pyx_v_j, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_v_distance); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 96, __pyx_L1_error)
  3665. __Pyx_GOTREF(__pyx_t_9);
  3666. __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
  3667. __pyx_t_14.memview = NULL;
  3668. __pyx_t_14.data = NULL;
  3669. __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
  3670. __pyx_t_15.memview = NULL;
  3671. __pyx_t_15.data = NULL;
  3672. if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) {
  3673. PyObject* sequence = __pyx_t_9;
  3674. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  3675. if (unlikely(size != 2)) {
  3676. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  3677. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  3678. __PYX_ERR(0, 96, __pyx_L1_error)
  3679. }
  3680. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  3681. if (likely(PyTuple_CheckExact(sequence))) {
  3682. __pyx_t_11 = PyTuple_GET_ITEM(sequence, 0);
  3683. __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1);
  3684. } else {
  3685. __pyx_t_11 = PyList_GET_ITEM(sequence, 0);
  3686. __pyx_t_7 = PyList_GET_ITEM(sequence, 1);
  3687. }
  3688. __Pyx_INCREF(__pyx_t_11);
  3689. __Pyx_INCREF(__pyx_t_7);
  3690. #else
  3691. __pyx_t_11 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 96, __pyx_L1_error)
  3692. __Pyx_GOTREF(__pyx_t_11);
  3693. __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L1_error)
  3694. __Pyx_GOTREF(__pyx_t_7);
  3695. #endif
  3696. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  3697. } else {
  3698. Py_ssize_t index = -1;
  3699. __pyx_t_8 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 96, __pyx_L1_error)
  3700. __Pyx_GOTREF(__pyx_t_8);
  3701. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  3702. __pyx_t_16 = Py_TYPE(__pyx_t_8)->tp_iternext;
  3703. index = 0; __pyx_t_11 = __pyx_t_16(__pyx_t_8); if (unlikely(!__pyx_t_11)) goto __pyx_L7_unpacking_failed;
  3704. __Pyx_GOTREF(__pyx_t_11);
  3705. index = 1; __pyx_t_7 = __pyx_t_16(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L7_unpacking_failed;
  3706. __Pyx_GOTREF(__pyx_t_7);
  3707. if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_8), 2) < 0) __PYX_ERR(0, 96, __pyx_L1_error)
  3708. __pyx_t_16 = NULL;
  3709. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3710. goto __pyx_L8_unpacking_done;
  3711. __pyx_L7_unpacking_failed:;
  3712. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3713. __pyx_t_16 = NULL;
  3714. if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
  3715. __PYX_ERR(0, 96, __pyx_L1_error)
  3716. __pyx_L8_unpacking_done:;
  3717. }
  3718. __Pyx_XDECREF_SET(__pyx_v_exp_i, __pyx_t_11);
  3719. __pyx_t_11 = 0;
  3720. __Pyx_XDECREF_SET(__pyx_v_exp_j, __pyx_t_7);
  3721. __pyx_t_7 = 0;
  3722. /* "app/trade/trade_utils.pyx":97
  3723. * distance = np.full_like(trade_range, -1)
  3724. * (exp_i, exp_j) = _trade_distance(i, j, trade_range[i, j], trade_distance, trade_value, distance)
  3725. * export_partner[i, j] = [exp_i, exp_j] # <<<<<<<<<<<<<<
  3726. *
  3727. *
  3728. */
  3729. __pyx_t_9 = PyList_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 97, __pyx_L1_error)
  3730. __Pyx_GOTREF(__pyx_t_9);
  3731. __Pyx_INCREF(__pyx_v_exp_i);
  3732. __Pyx_GIVEREF(__pyx_v_exp_i);
  3733. PyList_SET_ITEM(__pyx_t_9, 0, __pyx_v_exp_i);
  3734. __Pyx_INCREF(__pyx_v_exp_j);
  3735. __Pyx_GIVEREF(__pyx_v_exp_j);
  3736. PyList_SET_ITEM(__pyx_t_9, 1, __pyx_v_exp_j);
  3737. __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 97, __pyx_L1_error)
  3738. __Pyx_GOTREF(__pyx_t_7);
  3739. __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 97, __pyx_L1_error)
  3740. __Pyx_GOTREF(__pyx_t_11);
  3741. __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 97, __pyx_L1_error)
  3742. __Pyx_GOTREF(__pyx_t_8);
  3743. __Pyx_GIVEREF(__pyx_t_7);
  3744. PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7);
  3745. __Pyx_GIVEREF(__pyx_t_11);
  3746. PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_11);
  3747. __pyx_t_7 = 0;
  3748. __pyx_t_11 = 0;
  3749. if (unlikely(PyObject_SetItem(((PyObject *)__pyx_v_export_partner), __pyx_t_8, __pyx_t_9) < 0)) __PYX_ERR(0, 97, __pyx_L1_error)
  3750. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  3751. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  3752. }
  3753. }
  3754. /* "app/trade/trade_utils.pyx":88
  3755. * return exp, distance
  3756. *
  3757. * cpdef update_export_partner(trade_range: np.ndarray, trade_distance: np.ndarray, trade_value: np.ndarray, export_partner: np.ndarray): # <<<<<<<<<<<<<<
  3758. * cdef int width = trade_range.shape[0]
  3759. * cdef int height = trade_range.shape[1]
  3760. */
  3761. /* function exit code */
  3762. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  3763. goto __pyx_L0;
  3764. __pyx_L1_error:;
  3765. __Pyx_XDECREF(__pyx_t_7);
  3766. __Pyx_XDECREF(__pyx_t_8);
  3767. __Pyx_XDECREF(__pyx_t_9);
  3768. __Pyx_XDECREF(__pyx_t_11);
  3769. __PYX_XDEC_MEMVIEW(&__pyx_t_12, 1);
  3770. __PYX_XDEC_MEMVIEW(&__pyx_t_14, 1);
  3771. __PYX_XDEC_MEMVIEW(&__pyx_t_15, 1);
  3772. __Pyx_AddTraceback("app.trade.trade_utils.update_export_partner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3773. __pyx_r = 0;
  3774. __pyx_L0:;
  3775. __PYX_XDEC_MEMVIEW(&__pyx_v_distance, 1);
  3776. __Pyx_XDECREF(__pyx_v_exp_i);
  3777. __Pyx_XDECREF(__pyx_v_exp_j);
  3778. __Pyx_XGIVEREF(__pyx_r);
  3779. __Pyx_RefNannyFinishContext();
  3780. return __pyx_r;
  3781. }
  3782. /* Python wrapper */
  3783. static PyObject *__pyx_pw_3app_5trade_11trade_utils_3update_export_partner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  3784. static PyObject *__pyx_pw_3app_5trade_11trade_utils_3update_export_partner(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  3785. PyArrayObject *__pyx_v_trade_range = 0;
  3786. PyArrayObject *__pyx_v_trade_distance = 0;
  3787. PyArrayObject *__pyx_v_trade_value = 0;
  3788. PyArrayObject *__pyx_v_export_partner = 0;
  3789. PyObject *__pyx_r = 0;
  3790. __Pyx_RefNannyDeclarations
  3791. __Pyx_RefNannySetupContext("update_export_partner (wrapper)", 0);
  3792. {
  3793. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_trade_range,&__pyx_n_s_trade_distance,&__pyx_n_s_trade_value,&__pyx_n_s_export_partner,0};
  3794. PyObject* values[4] = {0,0,0,0};
  3795. if (unlikely(__pyx_kwds)) {
  3796. Py_ssize_t kw_args;
  3797. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  3798. switch (pos_args) {
  3799. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3800. CYTHON_FALLTHROUGH;
  3801. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3802. CYTHON_FALLTHROUGH;
  3803. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3804. CYTHON_FALLTHROUGH;
  3805. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3806. CYTHON_FALLTHROUGH;
  3807. case 0: break;
  3808. default: goto __pyx_L5_argtuple_error;
  3809. }
  3810. kw_args = PyDict_Size(__pyx_kwds);
  3811. switch (pos_args) {
  3812. case 0:
  3813. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trade_range)) != 0)) kw_args--;
  3814. else goto __pyx_L5_argtuple_error;
  3815. CYTHON_FALLTHROUGH;
  3816. case 1:
  3817. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trade_distance)) != 0)) kw_args--;
  3818. else {
  3819. __Pyx_RaiseArgtupleInvalid("update_export_partner", 1, 4, 4, 1); __PYX_ERR(0, 88, __pyx_L3_error)
  3820. }
  3821. CYTHON_FALLTHROUGH;
  3822. case 2:
  3823. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trade_value)) != 0)) kw_args--;
  3824. else {
  3825. __Pyx_RaiseArgtupleInvalid("update_export_partner", 1, 4, 4, 2); __PYX_ERR(0, 88, __pyx_L3_error)
  3826. }
  3827. CYTHON_FALLTHROUGH;
  3828. case 3:
  3829. if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_export_partner)) != 0)) kw_args--;
  3830. else {
  3831. __Pyx_RaiseArgtupleInvalid("update_export_partner", 1, 4, 4, 3); __PYX_ERR(0, 88, __pyx_L3_error)
  3832. }
  3833. }
  3834. if (unlikely(kw_args > 0)) {
  3835. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "update_export_partner") < 0)) __PYX_ERR(0, 88, __pyx_L3_error)
  3836. }
  3837. } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
  3838. goto __pyx_L5_argtuple_error;
  3839. } else {
  3840. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  3841. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  3842. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  3843. values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  3844. }
  3845. __pyx_v_trade_range = ((PyArrayObject *)values[0]);
  3846. __pyx_v_trade_distance = ((PyArrayObject *)values[1]);
  3847. __pyx_v_trade_value = ((PyArrayObject *)values[2]);
  3848. __pyx_v_export_partner = ((PyArrayObject *)values[3]);
  3849. }
  3850. goto __pyx_L4_argument_unpacking_done;
  3851. __pyx_L5_argtuple_error:;
  3852. __Pyx_RaiseArgtupleInvalid("update_export_partner", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 88, __pyx_L3_error)
  3853. __pyx_L3_error:;
  3854. __Pyx_AddTraceback("app.trade.trade_utils.update_export_partner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3855. __Pyx_RefNannyFinishContext();
  3856. return NULL;
  3857. __pyx_L4_argument_unpacking_done:;
  3858. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trade_range), __pyx_ptype_5numpy_ndarray, 1, "trade_range", 0))) __PYX_ERR(0, 88, __pyx_L1_error)
  3859. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trade_distance), __pyx_ptype_5numpy_ndarray, 1, "trade_distance", 0))) __PYX_ERR(0, 88, __pyx_L1_error)
  3860. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_trade_value), __pyx_ptype_5numpy_ndarray, 1, "trade_value", 0))) __PYX_ERR(0, 88, __pyx_L1_error)
  3861. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_export_partner), __pyx_ptype_5numpy_ndarray, 1, "export_partner", 0))) __PYX_ERR(0, 88, __pyx_L1_error)
  3862. __pyx_r = __pyx_pf_3app_5trade_11trade_utils_2update_export_partner(__pyx_self, __pyx_v_trade_range, __pyx_v_trade_distance, __pyx_v_trade_value, __pyx_v_export_partner);
  3863. /* function exit code */
  3864. goto __pyx_L0;
  3865. __pyx_L1_error:;
  3866. __pyx_r = NULL;
  3867. __pyx_L0:;
  3868. __Pyx_RefNannyFinishContext();
  3869. return __pyx_r;
  3870. }
  3871. static PyObject *__pyx_pf_3app_5trade_11trade_utils_2update_export_partner(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_trade_range, PyArrayObject *__pyx_v_trade_distance, PyArrayObject *__pyx_v_trade_value, PyArrayObject *__pyx_v_export_partner) {
  3872. PyObject *__pyx_r = NULL;
  3873. __Pyx_RefNannyDeclarations
  3874. PyObject *__pyx_t_1 = NULL;
  3875. __Pyx_RefNannySetupContext("update_export_partner", 0);
  3876. __Pyx_XDECREF(__pyx_r);
  3877. __pyx_t_1 = __pyx_f_3app_5trade_11trade_utils_update_export_partner(__pyx_v_trade_range, __pyx_v_trade_distance, __pyx_v_trade_value, __pyx_v_export_partner, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error)
  3878. __Pyx_GOTREF(__pyx_t_1);
  3879. __pyx_r = __pyx_t_1;
  3880. __pyx_t_1 = 0;
  3881. goto __pyx_L0;
  3882. /* function exit code */
  3883. __pyx_L1_error:;
  3884. __Pyx_XDECREF(__pyx_t_1);
  3885. __Pyx_AddTraceback("app.trade.trade_utils.update_export_partner", __pyx_clineno, __pyx_lineno, __pyx_filename);
  3886. __pyx_r = NULL;
  3887. __pyx_L0:;
  3888. __Pyx_XGIVEREF(__pyx_r);
  3889. __Pyx_RefNannyFinishContext();
  3890. return __pyx_r;
  3891. }
  3892. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":258
  3893. * # experimental exception made for __getbuffer__ and __releasebuffer__
  3894. * # -- the details of this may change.
  3895. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  3896. * # This implementation of getbuffer is geared towards Cython
  3897. * # requirements, and does not yet fulfill the PEP.
  3898. */
  3899. /* Python wrapper */
  3900. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  3901. static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  3902. int __pyx_r;
  3903. __Pyx_RefNannyDeclarations
  3904. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  3905. __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
  3906. /* function exit code */
  3907. __Pyx_RefNannyFinishContext();
  3908. return __pyx_r;
  3909. }
  3910. static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  3911. int __pyx_v_i;
  3912. int __pyx_v_ndim;
  3913. int __pyx_v_endian_detector;
  3914. int __pyx_v_little_endian;
  3915. int __pyx_v_t;
  3916. char *__pyx_v_f;
  3917. PyArray_Descr *__pyx_v_descr = 0;
  3918. int __pyx_v_offset;
  3919. int __pyx_r;
  3920. __Pyx_RefNannyDeclarations
  3921. int __pyx_t_1;
  3922. int __pyx_t_2;
  3923. PyObject *__pyx_t_3 = NULL;
  3924. int __pyx_t_4;
  3925. int __pyx_t_5;
  3926. int __pyx_t_6;
  3927. PyArray_Descr *__pyx_t_7;
  3928. PyObject *__pyx_t_8 = NULL;
  3929. char *__pyx_t_9;
  3930. if (__pyx_v_info == NULL) {
  3931. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  3932. return -1;
  3933. }
  3934. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  3935. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  3936. __Pyx_GIVEREF(__pyx_v_info->obj);
  3937. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":265
  3938. *
  3939. * cdef int i, ndim
  3940. * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
  3941. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  3942. *
  3943. */
  3944. __pyx_v_endian_detector = 1;
  3945. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":266
  3946. * cdef int i, ndim
  3947. * cdef int endian_detector = 1
  3948. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
  3949. *
  3950. * ndim = PyArray_NDIM(self)
  3951. */
  3952. __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  3953. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":268
  3954. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  3955. *
  3956. * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
  3957. *
  3958. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  3959. */
  3960. __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
  3961. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270
  3962. * ndim = PyArray_NDIM(self)
  3963. *
  3964. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  3965. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  3966. * raise ValueError(u"ndarray is not C contiguous")
  3967. */
  3968. __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
  3969. if (__pyx_t_2) {
  3970. } else {
  3971. __pyx_t_1 = __pyx_t_2;
  3972. goto __pyx_L4_bool_binop_done;
  3973. }
  3974. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":271
  3975. *
  3976. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  3977. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
  3978. * raise ValueError(u"ndarray is not C contiguous")
  3979. *
  3980. */
  3981. __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_C_CONTIGUOUS) != 0)) != 0);
  3982. __pyx_t_1 = __pyx_t_2;
  3983. __pyx_L4_bool_binop_done:;
  3984. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270
  3985. * ndim = PyArray_NDIM(self)
  3986. *
  3987. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  3988. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  3989. * raise ValueError(u"ndarray is not C contiguous")
  3990. */
  3991. if (unlikely(__pyx_t_1)) {
  3992. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":272
  3993. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  3994. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  3995. * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
  3996. *
  3997. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  3998. */
  3999. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 272, __pyx_L1_error)
  4000. __Pyx_GOTREF(__pyx_t_3);
  4001. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4002. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4003. __PYX_ERR(1, 272, __pyx_L1_error)
  4004. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":270
  4005. * ndim = PyArray_NDIM(self)
  4006. *
  4007. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
  4008. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  4009. * raise ValueError(u"ndarray is not C contiguous")
  4010. */
  4011. }
  4012. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274
  4013. * raise ValueError(u"ndarray is not C contiguous")
  4014. *
  4015. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  4016. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  4017. * raise ValueError(u"ndarray is not Fortran contiguous")
  4018. */
  4019. __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
  4020. if (__pyx_t_2) {
  4021. } else {
  4022. __pyx_t_1 = __pyx_t_2;
  4023. goto __pyx_L7_bool_binop_done;
  4024. }
  4025. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":275
  4026. *
  4027. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  4028. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
  4029. * raise ValueError(u"ndarray is not Fortran contiguous")
  4030. *
  4031. */
  4032. __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_ARRAY_F_CONTIGUOUS) != 0)) != 0);
  4033. __pyx_t_1 = __pyx_t_2;
  4034. __pyx_L7_bool_binop_done:;
  4035. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274
  4036. * raise ValueError(u"ndarray is not C contiguous")
  4037. *
  4038. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  4039. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  4040. * raise ValueError(u"ndarray is not Fortran contiguous")
  4041. */
  4042. if (unlikely(__pyx_t_1)) {
  4043. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":276
  4044. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  4045. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  4046. * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
  4047. *
  4048. * info.buf = PyArray_DATA(self)
  4049. */
  4050. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 276, __pyx_L1_error)
  4051. __Pyx_GOTREF(__pyx_t_3);
  4052. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4053. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4054. __PYX_ERR(1, 276, __pyx_L1_error)
  4055. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":274
  4056. * raise ValueError(u"ndarray is not C contiguous")
  4057. *
  4058. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
  4059. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  4060. * raise ValueError(u"ndarray is not Fortran contiguous")
  4061. */
  4062. }
  4063. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":278
  4064. * raise ValueError(u"ndarray is not Fortran contiguous")
  4065. *
  4066. * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
  4067. * info.ndim = ndim
  4068. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4069. */
  4070. __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
  4071. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":279
  4072. *
  4073. * info.buf = PyArray_DATA(self)
  4074. * info.ndim = ndim # <<<<<<<<<<<<<<
  4075. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4076. * # Allocate new buffer for strides and shape info.
  4077. */
  4078. __pyx_v_info->ndim = __pyx_v_ndim;
  4079. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":280
  4080. * info.buf = PyArray_DATA(self)
  4081. * info.ndim = ndim
  4082. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  4083. * # Allocate new buffer for strides and shape info.
  4084. * # This is allocated as one block, strides first.
  4085. */
  4086. __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  4087. if (__pyx_t_1) {
  4088. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":283
  4089. * # Allocate new buffer for strides and shape info.
  4090. * # This is allocated as one block, strides first.
  4091. * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim) # <<<<<<<<<<<<<<
  4092. * info.shape = info.strides + ndim
  4093. * for i in range(ndim):
  4094. */
  4095. __pyx_v_info->strides = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * 2) * ((size_t)__pyx_v_ndim))));
  4096. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":284
  4097. * # This is allocated as one block, strides first.
  4098. * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
  4099. * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
  4100. * for i in range(ndim):
  4101. * info.strides[i] = PyArray_STRIDES(self)[i]
  4102. */
  4103. __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
  4104. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":285
  4105. * info.strides = <Py_ssize_t*>PyObject_Malloc(sizeof(Py_ssize_t) * 2 * <size_t>ndim)
  4106. * info.shape = info.strides + ndim
  4107. * for i in range(ndim): # <<<<<<<<<<<<<<
  4108. * info.strides[i] = PyArray_STRIDES(self)[i]
  4109. * info.shape[i] = PyArray_DIMS(self)[i]
  4110. */
  4111. __pyx_t_4 = __pyx_v_ndim;
  4112. __pyx_t_5 = __pyx_t_4;
  4113. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  4114. __pyx_v_i = __pyx_t_6;
  4115. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":286
  4116. * info.shape = info.strides + ndim
  4117. * for i in range(ndim):
  4118. * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
  4119. * info.shape[i] = PyArray_DIMS(self)[i]
  4120. * else:
  4121. */
  4122. (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
  4123. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":287
  4124. * for i in range(ndim):
  4125. * info.strides[i] = PyArray_STRIDES(self)[i]
  4126. * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
  4127. * else:
  4128. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  4129. */
  4130. (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
  4131. }
  4132. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":280
  4133. * info.buf = PyArray_DATA(self)
  4134. * info.ndim = ndim
  4135. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  4136. * # Allocate new buffer for strides and shape info.
  4137. * # This is allocated as one block, strides first.
  4138. */
  4139. goto __pyx_L9;
  4140. }
  4141. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":289
  4142. * info.shape[i] = PyArray_DIMS(self)[i]
  4143. * else:
  4144. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
  4145. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  4146. * info.suboffsets = NULL
  4147. */
  4148. /*else*/ {
  4149. __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
  4150. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":290
  4151. * else:
  4152. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  4153. * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
  4154. * info.suboffsets = NULL
  4155. * info.itemsize = PyArray_ITEMSIZE(self)
  4156. */
  4157. __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
  4158. }
  4159. __pyx_L9:;
  4160. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":291
  4161. * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
  4162. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  4163. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  4164. * info.itemsize = PyArray_ITEMSIZE(self)
  4165. * info.readonly = not PyArray_ISWRITEABLE(self)
  4166. */
  4167. __pyx_v_info->suboffsets = NULL;
  4168. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":292
  4169. * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
  4170. * info.suboffsets = NULL
  4171. * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
  4172. * info.readonly = not PyArray_ISWRITEABLE(self)
  4173. *
  4174. */
  4175. __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
  4176. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":293
  4177. * info.suboffsets = NULL
  4178. * info.itemsize = PyArray_ITEMSIZE(self)
  4179. * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
  4180. *
  4181. * cdef int t
  4182. */
  4183. __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
  4184. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":296
  4185. *
  4186. * cdef int t
  4187. * cdef char* f = NULL # <<<<<<<<<<<<<<
  4188. * cdef dtype descr = <dtype>PyArray_DESCR(self)
  4189. * cdef int offset
  4190. */
  4191. __pyx_v_f = NULL;
  4192. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":297
  4193. * cdef int t
  4194. * cdef char* f = NULL
  4195. * cdef dtype descr = <dtype>PyArray_DESCR(self) # <<<<<<<<<<<<<<
  4196. * cdef int offset
  4197. *
  4198. */
  4199. __pyx_t_7 = PyArray_DESCR(__pyx_v_self);
  4200. __pyx_t_3 = ((PyObject *)__pyx_t_7);
  4201. __Pyx_INCREF(__pyx_t_3);
  4202. __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
  4203. __pyx_t_3 = 0;
  4204. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":300
  4205. * cdef int offset
  4206. *
  4207. * info.obj = self # <<<<<<<<<<<<<<
  4208. *
  4209. * if not PyDataType_HASFIELDS(descr):
  4210. */
  4211. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  4212. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  4213. __Pyx_GOTREF(__pyx_v_info->obj);
  4214. __Pyx_DECREF(__pyx_v_info->obj);
  4215. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  4216. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":302
  4217. * info.obj = self
  4218. *
  4219. * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
  4220. * t = descr.type_num
  4221. * if ((descr.byteorder == c'>' and little_endian) or
  4222. */
  4223. __pyx_t_1 = ((!(PyDataType_HASFIELDS(__pyx_v_descr) != 0)) != 0);
  4224. if (__pyx_t_1) {
  4225. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":303
  4226. *
  4227. * if not PyDataType_HASFIELDS(descr):
  4228. * t = descr.type_num # <<<<<<<<<<<<<<
  4229. * if ((descr.byteorder == c'>' and little_endian) or
  4230. * (descr.byteorder == c'<' and not little_endian)):
  4231. */
  4232. __pyx_t_4 = __pyx_v_descr->type_num;
  4233. __pyx_v_t = __pyx_t_4;
  4234. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304
  4235. * if not PyDataType_HASFIELDS(descr):
  4236. * t = descr.type_num
  4237. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  4238. * (descr.byteorder == c'<' and not little_endian)):
  4239. * raise ValueError(u"Non-native byte order not supported")
  4240. */
  4241. __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
  4242. if (!__pyx_t_2) {
  4243. goto __pyx_L15_next_or;
  4244. } else {
  4245. }
  4246. __pyx_t_2 = (__pyx_v_little_endian != 0);
  4247. if (!__pyx_t_2) {
  4248. } else {
  4249. __pyx_t_1 = __pyx_t_2;
  4250. goto __pyx_L14_bool_binop_done;
  4251. }
  4252. __pyx_L15_next_or:;
  4253. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":305
  4254. * t = descr.type_num
  4255. * if ((descr.byteorder == c'>' and little_endian) or
  4256. * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
  4257. * raise ValueError(u"Non-native byte order not supported")
  4258. * if t == NPY_BYTE: f = "b"
  4259. */
  4260. __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
  4261. if (__pyx_t_2) {
  4262. } else {
  4263. __pyx_t_1 = __pyx_t_2;
  4264. goto __pyx_L14_bool_binop_done;
  4265. }
  4266. __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
  4267. __pyx_t_1 = __pyx_t_2;
  4268. __pyx_L14_bool_binop_done:;
  4269. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304
  4270. * if not PyDataType_HASFIELDS(descr):
  4271. * t = descr.type_num
  4272. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  4273. * (descr.byteorder == c'<' and not little_endian)):
  4274. * raise ValueError(u"Non-native byte order not supported")
  4275. */
  4276. if (unlikely(__pyx_t_1)) {
  4277. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":306
  4278. * if ((descr.byteorder == c'>' and little_endian) or
  4279. * (descr.byteorder == c'<' and not little_endian)):
  4280. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  4281. * if t == NPY_BYTE: f = "b"
  4282. * elif t == NPY_UBYTE: f = "B"
  4283. */
  4284. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 306, __pyx_L1_error)
  4285. __Pyx_GOTREF(__pyx_t_3);
  4286. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4287. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4288. __PYX_ERR(1, 306, __pyx_L1_error)
  4289. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":304
  4290. * if not PyDataType_HASFIELDS(descr):
  4291. * t = descr.type_num
  4292. * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  4293. * (descr.byteorder == c'<' and not little_endian)):
  4294. * raise ValueError(u"Non-native byte order not supported")
  4295. */
  4296. }
  4297. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":307
  4298. * (descr.byteorder == c'<' and not little_endian)):
  4299. * raise ValueError(u"Non-native byte order not supported")
  4300. * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
  4301. * elif t == NPY_UBYTE: f = "B"
  4302. * elif t == NPY_SHORT: f = "h"
  4303. */
  4304. switch (__pyx_v_t) {
  4305. case NPY_BYTE:
  4306. __pyx_v_f = ((char *)"b");
  4307. break;
  4308. case NPY_UBYTE:
  4309. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":308
  4310. * raise ValueError(u"Non-native byte order not supported")
  4311. * if t == NPY_BYTE: f = "b"
  4312. * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
  4313. * elif t == NPY_SHORT: f = "h"
  4314. * elif t == NPY_USHORT: f = "H"
  4315. */
  4316. __pyx_v_f = ((char *)"B");
  4317. break;
  4318. case NPY_SHORT:
  4319. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":309
  4320. * if t == NPY_BYTE: f = "b"
  4321. * elif t == NPY_UBYTE: f = "B"
  4322. * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
  4323. * elif t == NPY_USHORT: f = "H"
  4324. * elif t == NPY_INT: f = "i"
  4325. */
  4326. __pyx_v_f = ((char *)"h");
  4327. break;
  4328. case NPY_USHORT:
  4329. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":310
  4330. * elif t == NPY_UBYTE: f = "B"
  4331. * elif t == NPY_SHORT: f = "h"
  4332. * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
  4333. * elif t == NPY_INT: f = "i"
  4334. * elif t == NPY_UINT: f = "I"
  4335. */
  4336. __pyx_v_f = ((char *)"H");
  4337. break;
  4338. case NPY_INT:
  4339. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":311
  4340. * elif t == NPY_SHORT: f = "h"
  4341. * elif t == NPY_USHORT: f = "H"
  4342. * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
  4343. * elif t == NPY_UINT: f = "I"
  4344. * elif t == NPY_LONG: f = "l"
  4345. */
  4346. __pyx_v_f = ((char *)"i");
  4347. break;
  4348. case NPY_UINT:
  4349. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":312
  4350. * elif t == NPY_USHORT: f = "H"
  4351. * elif t == NPY_INT: f = "i"
  4352. * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
  4353. * elif t == NPY_LONG: f = "l"
  4354. * elif t == NPY_ULONG: f = "L"
  4355. */
  4356. __pyx_v_f = ((char *)"I");
  4357. break;
  4358. case NPY_LONG:
  4359. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":313
  4360. * elif t == NPY_INT: f = "i"
  4361. * elif t == NPY_UINT: f = "I"
  4362. * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
  4363. * elif t == NPY_ULONG: f = "L"
  4364. * elif t == NPY_LONGLONG: f = "q"
  4365. */
  4366. __pyx_v_f = ((char *)"l");
  4367. break;
  4368. case NPY_ULONG:
  4369. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":314
  4370. * elif t == NPY_UINT: f = "I"
  4371. * elif t == NPY_LONG: f = "l"
  4372. * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
  4373. * elif t == NPY_LONGLONG: f = "q"
  4374. * elif t == NPY_ULONGLONG: f = "Q"
  4375. */
  4376. __pyx_v_f = ((char *)"L");
  4377. break;
  4378. case NPY_LONGLONG:
  4379. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":315
  4380. * elif t == NPY_LONG: f = "l"
  4381. * elif t == NPY_ULONG: f = "L"
  4382. * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
  4383. * elif t == NPY_ULONGLONG: f = "Q"
  4384. * elif t == NPY_FLOAT: f = "f"
  4385. */
  4386. __pyx_v_f = ((char *)"q");
  4387. break;
  4388. case NPY_ULONGLONG:
  4389. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":316
  4390. * elif t == NPY_ULONG: f = "L"
  4391. * elif t == NPY_LONGLONG: f = "q"
  4392. * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
  4393. * elif t == NPY_FLOAT: f = "f"
  4394. * elif t == NPY_DOUBLE: f = "d"
  4395. */
  4396. __pyx_v_f = ((char *)"Q");
  4397. break;
  4398. case NPY_FLOAT:
  4399. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":317
  4400. * elif t == NPY_LONGLONG: f = "q"
  4401. * elif t == NPY_ULONGLONG: f = "Q"
  4402. * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
  4403. * elif t == NPY_DOUBLE: f = "d"
  4404. * elif t == NPY_LONGDOUBLE: f = "g"
  4405. */
  4406. __pyx_v_f = ((char *)"f");
  4407. break;
  4408. case NPY_DOUBLE:
  4409. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":318
  4410. * elif t == NPY_ULONGLONG: f = "Q"
  4411. * elif t == NPY_FLOAT: f = "f"
  4412. * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
  4413. * elif t == NPY_LONGDOUBLE: f = "g"
  4414. * elif t == NPY_CFLOAT: f = "Zf"
  4415. */
  4416. __pyx_v_f = ((char *)"d");
  4417. break;
  4418. case NPY_LONGDOUBLE:
  4419. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":319
  4420. * elif t == NPY_FLOAT: f = "f"
  4421. * elif t == NPY_DOUBLE: f = "d"
  4422. * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
  4423. * elif t == NPY_CFLOAT: f = "Zf"
  4424. * elif t == NPY_CDOUBLE: f = "Zd"
  4425. */
  4426. __pyx_v_f = ((char *)"g");
  4427. break;
  4428. case NPY_CFLOAT:
  4429. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":320
  4430. * elif t == NPY_DOUBLE: f = "d"
  4431. * elif t == NPY_LONGDOUBLE: f = "g"
  4432. * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
  4433. * elif t == NPY_CDOUBLE: f = "Zd"
  4434. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  4435. */
  4436. __pyx_v_f = ((char *)"Zf");
  4437. break;
  4438. case NPY_CDOUBLE:
  4439. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":321
  4440. * elif t == NPY_LONGDOUBLE: f = "g"
  4441. * elif t == NPY_CFLOAT: f = "Zf"
  4442. * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
  4443. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  4444. * elif t == NPY_OBJECT: f = "O"
  4445. */
  4446. __pyx_v_f = ((char *)"Zd");
  4447. break;
  4448. case NPY_CLONGDOUBLE:
  4449. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":322
  4450. * elif t == NPY_CFLOAT: f = "Zf"
  4451. * elif t == NPY_CDOUBLE: f = "Zd"
  4452. * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
  4453. * elif t == NPY_OBJECT: f = "O"
  4454. * else:
  4455. */
  4456. __pyx_v_f = ((char *)"Zg");
  4457. break;
  4458. case NPY_OBJECT:
  4459. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":323
  4460. * elif t == NPY_CDOUBLE: f = "Zd"
  4461. * elif t == NPY_CLONGDOUBLE: f = "Zg"
  4462. * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
  4463. * else:
  4464. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  4465. */
  4466. __pyx_v_f = ((char *)"O");
  4467. break;
  4468. default:
  4469. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":325
  4470. * elif t == NPY_OBJECT: f = "O"
  4471. * else:
  4472. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
  4473. * info.format = f
  4474. * return
  4475. */
  4476. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
  4477. __Pyx_GOTREF(__pyx_t_3);
  4478. __pyx_t_8 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 325, __pyx_L1_error)
  4479. __Pyx_GOTREF(__pyx_t_8);
  4480. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4481. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 325, __pyx_L1_error)
  4482. __Pyx_GOTREF(__pyx_t_3);
  4483. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  4484. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  4485. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  4486. __PYX_ERR(1, 325, __pyx_L1_error)
  4487. break;
  4488. }
  4489. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":326
  4490. * else:
  4491. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  4492. * info.format = f # <<<<<<<<<<<<<<
  4493. * return
  4494. * else:
  4495. */
  4496. __pyx_v_info->format = __pyx_v_f;
  4497. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":327
  4498. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  4499. * info.format = f
  4500. * return # <<<<<<<<<<<<<<
  4501. * else:
  4502. * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
  4503. */
  4504. __pyx_r = 0;
  4505. goto __pyx_L0;
  4506. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":302
  4507. * info.obj = self
  4508. *
  4509. * if not PyDataType_HASFIELDS(descr): # <<<<<<<<<<<<<<
  4510. * t = descr.type_num
  4511. * if ((descr.byteorder == c'>' and little_endian) or
  4512. */
  4513. }
  4514. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":329
  4515. * return
  4516. * else:
  4517. * info.format = <char*>PyObject_Malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
  4518. * info.format[0] = c'^' # Native data types, manual alignment
  4519. * offset = 0
  4520. */
  4521. /*else*/ {
  4522. __pyx_v_info->format = ((char *)PyObject_Malloc(0xFF));
  4523. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":330
  4524. * else:
  4525. * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
  4526. * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
  4527. * offset = 0
  4528. * f = _util_dtypestring(descr, info.format + 1,
  4529. */
  4530. (__pyx_v_info->format[0]) = '^';
  4531. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":331
  4532. * info.format = <char*>PyObject_Malloc(_buffer_format_string_len)
  4533. * info.format[0] = c'^' # Native data types, manual alignment
  4534. * offset = 0 # <<<<<<<<<<<<<<
  4535. * f = _util_dtypestring(descr, info.format + 1,
  4536. * info.format + _buffer_format_string_len,
  4537. */
  4538. __pyx_v_offset = 0;
  4539. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":332
  4540. * info.format[0] = c'^' # Native data types, manual alignment
  4541. * offset = 0
  4542. * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
  4543. * info.format + _buffer_format_string_len,
  4544. * &offset)
  4545. */
  4546. __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 332, __pyx_L1_error)
  4547. __pyx_v_f = __pyx_t_9;
  4548. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":335
  4549. * info.format + _buffer_format_string_len,
  4550. * &offset)
  4551. * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
  4552. *
  4553. * def __releasebuffer__(ndarray self, Py_buffer* info):
  4554. */
  4555. (__pyx_v_f[0]) = '\x00';
  4556. }
  4557. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":258
  4558. * # experimental exception made for __getbuffer__ and __releasebuffer__
  4559. * # -- the details of this may change.
  4560. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
  4561. * # This implementation of getbuffer is geared towards Cython
  4562. * # requirements, and does not yet fulfill the PEP.
  4563. */
  4564. /* function exit code */
  4565. __pyx_r = 0;
  4566. goto __pyx_L0;
  4567. __pyx_L1_error:;
  4568. __Pyx_XDECREF(__pyx_t_3);
  4569. __Pyx_XDECREF(__pyx_t_8);
  4570. __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4571. __pyx_r = -1;
  4572. if (__pyx_v_info->obj != NULL) {
  4573. __Pyx_GOTREF(__pyx_v_info->obj);
  4574. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  4575. }
  4576. goto __pyx_L2;
  4577. __pyx_L0:;
  4578. if (__pyx_v_info->obj == Py_None) {
  4579. __Pyx_GOTREF(__pyx_v_info->obj);
  4580. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  4581. }
  4582. __pyx_L2:;
  4583. __Pyx_XDECREF((PyObject *)__pyx_v_descr);
  4584. __Pyx_RefNannyFinishContext();
  4585. return __pyx_r;
  4586. }
  4587. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":337
  4588. * f[0] = c'\0' # Terminate format string
  4589. *
  4590. * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
  4591. * if PyArray_HASFIELDS(self):
  4592. * PyObject_Free(info.format)
  4593. */
  4594. /* Python wrapper */
  4595. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
  4596. static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  4597. __Pyx_RefNannyDeclarations
  4598. __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
  4599. __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
  4600. /* function exit code */
  4601. __Pyx_RefNannyFinishContext();
  4602. }
  4603. static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
  4604. __Pyx_RefNannyDeclarations
  4605. int __pyx_t_1;
  4606. __Pyx_RefNannySetupContext("__releasebuffer__", 0);
  4607. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":338
  4608. *
  4609. * def __releasebuffer__(ndarray self, Py_buffer* info):
  4610. * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
  4611. * PyObject_Free(info.format)
  4612. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4613. */
  4614. __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
  4615. if (__pyx_t_1) {
  4616. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":339
  4617. * def __releasebuffer__(ndarray self, Py_buffer* info):
  4618. * if PyArray_HASFIELDS(self):
  4619. * PyObject_Free(info.format) # <<<<<<<<<<<<<<
  4620. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4621. * PyObject_Free(info.strides)
  4622. */
  4623. PyObject_Free(__pyx_v_info->format);
  4624. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":338
  4625. *
  4626. * def __releasebuffer__(ndarray self, Py_buffer* info):
  4627. * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
  4628. * PyObject_Free(info.format)
  4629. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4630. */
  4631. }
  4632. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":340
  4633. * if PyArray_HASFIELDS(self):
  4634. * PyObject_Free(info.format)
  4635. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  4636. * PyObject_Free(info.strides)
  4637. * # info.shape was stored after info.strides in the same block
  4638. */
  4639. __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
  4640. if (__pyx_t_1) {
  4641. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":341
  4642. * PyObject_Free(info.format)
  4643. * if sizeof(npy_intp) != sizeof(Py_ssize_t):
  4644. * PyObject_Free(info.strides) # <<<<<<<<<<<<<<
  4645. * # info.shape was stored after info.strides in the same block
  4646. *
  4647. */
  4648. PyObject_Free(__pyx_v_info->strides);
  4649. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":340
  4650. * if PyArray_HASFIELDS(self):
  4651. * PyObject_Free(info.format)
  4652. * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
  4653. * PyObject_Free(info.strides)
  4654. * # info.shape was stored after info.strides in the same block
  4655. */
  4656. }
  4657. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":337
  4658. * f[0] = c'\0' # Terminate format string
  4659. *
  4660. * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
  4661. * if PyArray_HASFIELDS(self):
  4662. * PyObject_Free(info.format)
  4663. */
  4664. /* function exit code */
  4665. __Pyx_RefNannyFinishContext();
  4666. }
  4667. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":821
  4668. * ctypedef npy_cdouble complex_t
  4669. *
  4670. * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
  4671. * return PyArray_MultiIterNew(1, <void*>a)
  4672. *
  4673. */
  4674. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
  4675. PyObject *__pyx_r = NULL;
  4676. __Pyx_RefNannyDeclarations
  4677. PyObject *__pyx_t_1 = NULL;
  4678. __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
  4679. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":822
  4680. *
  4681. * cdef inline object PyArray_MultiIterNew1(a):
  4682. * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
  4683. *
  4684. * cdef inline object PyArray_MultiIterNew2(a, b):
  4685. */
  4686. __Pyx_XDECREF(__pyx_r);
  4687. __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 822, __pyx_L1_error)
  4688. __Pyx_GOTREF(__pyx_t_1);
  4689. __pyx_r = __pyx_t_1;
  4690. __pyx_t_1 = 0;
  4691. goto __pyx_L0;
  4692. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":821
  4693. * ctypedef npy_cdouble complex_t
  4694. *
  4695. * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
  4696. * return PyArray_MultiIterNew(1, <void*>a)
  4697. *
  4698. */
  4699. /* function exit code */
  4700. __pyx_L1_error:;
  4701. __Pyx_XDECREF(__pyx_t_1);
  4702. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4703. __pyx_r = 0;
  4704. __pyx_L0:;
  4705. __Pyx_XGIVEREF(__pyx_r);
  4706. __Pyx_RefNannyFinishContext();
  4707. return __pyx_r;
  4708. }
  4709. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":824
  4710. * return PyArray_MultiIterNew(1, <void*>a)
  4711. *
  4712. * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
  4713. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  4714. *
  4715. */
  4716. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
  4717. PyObject *__pyx_r = NULL;
  4718. __Pyx_RefNannyDeclarations
  4719. PyObject *__pyx_t_1 = NULL;
  4720. __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
  4721. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":825
  4722. *
  4723. * cdef inline object PyArray_MultiIterNew2(a, b):
  4724. * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
  4725. *
  4726. * cdef inline object PyArray_MultiIterNew3(a, b, c):
  4727. */
  4728. __Pyx_XDECREF(__pyx_r);
  4729. __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 825, __pyx_L1_error)
  4730. __Pyx_GOTREF(__pyx_t_1);
  4731. __pyx_r = __pyx_t_1;
  4732. __pyx_t_1 = 0;
  4733. goto __pyx_L0;
  4734. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":824
  4735. * return PyArray_MultiIterNew(1, <void*>a)
  4736. *
  4737. * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
  4738. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  4739. *
  4740. */
  4741. /* function exit code */
  4742. __pyx_L1_error:;
  4743. __Pyx_XDECREF(__pyx_t_1);
  4744. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4745. __pyx_r = 0;
  4746. __pyx_L0:;
  4747. __Pyx_XGIVEREF(__pyx_r);
  4748. __Pyx_RefNannyFinishContext();
  4749. return __pyx_r;
  4750. }
  4751. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":827
  4752. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  4753. *
  4754. * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
  4755. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  4756. *
  4757. */
  4758. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
  4759. PyObject *__pyx_r = NULL;
  4760. __Pyx_RefNannyDeclarations
  4761. PyObject *__pyx_t_1 = NULL;
  4762. __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
  4763. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":828
  4764. *
  4765. * cdef inline object PyArray_MultiIterNew3(a, b, c):
  4766. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
  4767. *
  4768. * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  4769. */
  4770. __Pyx_XDECREF(__pyx_r);
  4771. __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 828, __pyx_L1_error)
  4772. __Pyx_GOTREF(__pyx_t_1);
  4773. __pyx_r = __pyx_t_1;
  4774. __pyx_t_1 = 0;
  4775. goto __pyx_L0;
  4776. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":827
  4777. * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
  4778. *
  4779. * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
  4780. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  4781. *
  4782. */
  4783. /* function exit code */
  4784. __pyx_L1_error:;
  4785. __Pyx_XDECREF(__pyx_t_1);
  4786. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4787. __pyx_r = 0;
  4788. __pyx_L0:;
  4789. __Pyx_XGIVEREF(__pyx_r);
  4790. __Pyx_RefNannyFinishContext();
  4791. return __pyx_r;
  4792. }
  4793. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":830
  4794. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  4795. *
  4796. * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
  4797. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  4798. *
  4799. */
  4800. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
  4801. PyObject *__pyx_r = NULL;
  4802. __Pyx_RefNannyDeclarations
  4803. PyObject *__pyx_t_1 = NULL;
  4804. __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
  4805. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":831
  4806. *
  4807. * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
  4808. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
  4809. *
  4810. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  4811. */
  4812. __Pyx_XDECREF(__pyx_r);
  4813. __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 831, __pyx_L1_error)
  4814. __Pyx_GOTREF(__pyx_t_1);
  4815. __pyx_r = __pyx_t_1;
  4816. __pyx_t_1 = 0;
  4817. goto __pyx_L0;
  4818. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":830
  4819. * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
  4820. *
  4821. * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
  4822. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  4823. *
  4824. */
  4825. /* function exit code */
  4826. __pyx_L1_error:;
  4827. __Pyx_XDECREF(__pyx_t_1);
  4828. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4829. __pyx_r = 0;
  4830. __pyx_L0:;
  4831. __Pyx_XGIVEREF(__pyx_r);
  4832. __Pyx_RefNannyFinishContext();
  4833. return __pyx_r;
  4834. }
  4835. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":833
  4836. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  4837. *
  4838. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
  4839. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  4840. *
  4841. */
  4842. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
  4843. PyObject *__pyx_r = NULL;
  4844. __Pyx_RefNannyDeclarations
  4845. PyObject *__pyx_t_1 = NULL;
  4846. __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
  4847. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":834
  4848. *
  4849. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
  4850. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
  4851. *
  4852. * cdef inline tuple PyDataType_SHAPE(dtype d):
  4853. */
  4854. __Pyx_XDECREF(__pyx_r);
  4855. __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 834, __pyx_L1_error)
  4856. __Pyx_GOTREF(__pyx_t_1);
  4857. __pyx_r = __pyx_t_1;
  4858. __pyx_t_1 = 0;
  4859. goto __pyx_L0;
  4860. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":833
  4861. * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
  4862. *
  4863. * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
  4864. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  4865. *
  4866. */
  4867. /* function exit code */
  4868. __pyx_L1_error:;
  4869. __Pyx_XDECREF(__pyx_t_1);
  4870. __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
  4871. __pyx_r = 0;
  4872. __pyx_L0:;
  4873. __Pyx_XGIVEREF(__pyx_r);
  4874. __Pyx_RefNannyFinishContext();
  4875. return __pyx_r;
  4876. }
  4877. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":836
  4878. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  4879. *
  4880. * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
  4881. * if PyDataType_HASSUBARRAY(d):
  4882. * return <tuple>d.subarray.shape
  4883. */
  4884. static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
  4885. PyObject *__pyx_r = NULL;
  4886. __Pyx_RefNannyDeclarations
  4887. int __pyx_t_1;
  4888. __Pyx_RefNannySetupContext("PyDataType_SHAPE", 0);
  4889. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":837
  4890. *
  4891. * cdef inline tuple PyDataType_SHAPE(dtype d):
  4892. * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
  4893. * return <tuple>d.subarray.shape
  4894. * else:
  4895. */
  4896. __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
  4897. if (__pyx_t_1) {
  4898. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":838
  4899. * cdef inline tuple PyDataType_SHAPE(dtype d):
  4900. * if PyDataType_HASSUBARRAY(d):
  4901. * return <tuple>d.subarray.shape # <<<<<<<<<<<<<<
  4902. * else:
  4903. * return ()
  4904. */
  4905. __Pyx_XDECREF(__pyx_r);
  4906. __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
  4907. __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
  4908. goto __pyx_L0;
  4909. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":837
  4910. *
  4911. * cdef inline tuple PyDataType_SHAPE(dtype d):
  4912. * if PyDataType_HASSUBARRAY(d): # <<<<<<<<<<<<<<
  4913. * return <tuple>d.subarray.shape
  4914. * else:
  4915. */
  4916. }
  4917. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":840
  4918. * return <tuple>d.subarray.shape
  4919. * else:
  4920. * return () # <<<<<<<<<<<<<<
  4921. *
  4922. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
  4923. */
  4924. /*else*/ {
  4925. __Pyx_XDECREF(__pyx_r);
  4926. __Pyx_INCREF(__pyx_empty_tuple);
  4927. __pyx_r = __pyx_empty_tuple;
  4928. goto __pyx_L0;
  4929. }
  4930. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":836
  4931. * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
  4932. *
  4933. * cdef inline tuple PyDataType_SHAPE(dtype d): # <<<<<<<<<<<<<<
  4934. * if PyDataType_HASSUBARRAY(d):
  4935. * return <tuple>d.subarray.shape
  4936. */
  4937. /* function exit code */
  4938. __pyx_L0:;
  4939. __Pyx_XGIVEREF(__pyx_r);
  4940. __Pyx_RefNannyFinishContext();
  4941. return __pyx_r;
  4942. }
  4943. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":842
  4944. * return ()
  4945. *
  4946. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
  4947. * # Recursive utility function used in __getbuffer__ to get format
  4948. * # string. The new location in the format string is returned.
  4949. */
  4950. static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
  4951. PyArray_Descr *__pyx_v_child = 0;
  4952. int __pyx_v_endian_detector;
  4953. int __pyx_v_little_endian;
  4954. PyObject *__pyx_v_fields = 0;
  4955. PyObject *__pyx_v_childname = NULL;
  4956. PyObject *__pyx_v_new_offset = NULL;
  4957. PyObject *__pyx_v_t = NULL;
  4958. char *__pyx_r;
  4959. __Pyx_RefNannyDeclarations
  4960. PyObject *__pyx_t_1 = NULL;
  4961. Py_ssize_t __pyx_t_2;
  4962. PyObject *__pyx_t_3 = NULL;
  4963. PyObject *__pyx_t_4 = NULL;
  4964. int __pyx_t_5;
  4965. int __pyx_t_6;
  4966. int __pyx_t_7;
  4967. long __pyx_t_8;
  4968. char *__pyx_t_9;
  4969. __Pyx_RefNannySetupContext("_util_dtypestring", 0);
  4970. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":847
  4971. *
  4972. * cdef dtype child
  4973. * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
  4974. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
  4975. * cdef tuple fields
  4976. */
  4977. __pyx_v_endian_detector = 1;
  4978. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":848
  4979. * cdef dtype child
  4980. * cdef int endian_detector = 1
  4981. * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
  4982. * cdef tuple fields
  4983. *
  4984. */
  4985. __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
  4986. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":851
  4987. * cdef tuple fields
  4988. *
  4989. * for childname in descr.names: # <<<<<<<<<<<<<<
  4990. * fields = descr.fields[childname]
  4991. * child, new_offset = fields
  4992. */
  4993. if (unlikely(__pyx_v_descr->names == Py_None)) {
  4994. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  4995. __PYX_ERR(1, 851, __pyx_L1_error)
  4996. }
  4997. __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
  4998. for (;;) {
  4999. if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
  5000. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5001. __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 851, __pyx_L1_error)
  5002. #else
  5003. __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 851, __pyx_L1_error)
  5004. __Pyx_GOTREF(__pyx_t_3);
  5005. #endif
  5006. __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
  5007. __pyx_t_3 = 0;
  5008. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":852
  5009. *
  5010. * for childname in descr.names:
  5011. * fields = descr.fields[childname] # <<<<<<<<<<<<<<
  5012. * child, new_offset = fields
  5013. *
  5014. */
  5015. if (unlikely(__pyx_v_descr->fields == Py_None)) {
  5016. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  5017. __PYX_ERR(1, 852, __pyx_L1_error)
  5018. }
  5019. __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 852, __pyx_L1_error)
  5020. __Pyx_GOTREF(__pyx_t_3);
  5021. if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 852, __pyx_L1_error)
  5022. __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
  5023. __pyx_t_3 = 0;
  5024. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":853
  5025. * for childname in descr.names:
  5026. * fields = descr.fields[childname]
  5027. * child, new_offset = fields # <<<<<<<<<<<<<<
  5028. *
  5029. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  5030. */
  5031. if (likely(__pyx_v_fields != Py_None)) {
  5032. PyObject* sequence = __pyx_v_fields;
  5033. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  5034. if (unlikely(size != 2)) {
  5035. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  5036. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  5037. __PYX_ERR(1, 853, __pyx_L1_error)
  5038. }
  5039. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  5040. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  5041. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  5042. __Pyx_INCREF(__pyx_t_3);
  5043. __Pyx_INCREF(__pyx_t_4);
  5044. #else
  5045. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 853, __pyx_L1_error)
  5046. __Pyx_GOTREF(__pyx_t_3);
  5047. __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 853, __pyx_L1_error)
  5048. __Pyx_GOTREF(__pyx_t_4);
  5049. #endif
  5050. } else {
  5051. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 853, __pyx_L1_error)
  5052. }
  5053. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 853, __pyx_L1_error)
  5054. __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
  5055. __pyx_t_3 = 0;
  5056. __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
  5057. __pyx_t_4 = 0;
  5058. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":855
  5059. * child, new_offset = fields
  5060. *
  5061. * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
  5062. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  5063. *
  5064. */
  5065. __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 855, __pyx_L1_error)
  5066. __Pyx_GOTREF(__pyx_t_4);
  5067. __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 855, __pyx_L1_error)
  5068. __Pyx_GOTREF(__pyx_t_3);
  5069. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5070. __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 855, __pyx_L1_error)
  5071. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5072. __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
  5073. if (unlikely(__pyx_t_6)) {
  5074. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":856
  5075. *
  5076. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  5077. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
  5078. *
  5079. * if ((child.byteorder == c'>' and little_endian) or
  5080. */
  5081. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 856, __pyx_L1_error)
  5082. __Pyx_GOTREF(__pyx_t_3);
  5083. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  5084. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5085. __PYX_ERR(1, 856, __pyx_L1_error)
  5086. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":855
  5087. * child, new_offset = fields
  5088. *
  5089. * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
  5090. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  5091. *
  5092. */
  5093. }
  5094. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858
  5095. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  5096. *
  5097. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  5098. * (child.byteorder == c'<' and not little_endian)):
  5099. * raise ValueError(u"Non-native byte order not supported")
  5100. */
  5101. __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
  5102. if (!__pyx_t_7) {
  5103. goto __pyx_L8_next_or;
  5104. } else {
  5105. }
  5106. __pyx_t_7 = (__pyx_v_little_endian != 0);
  5107. if (!__pyx_t_7) {
  5108. } else {
  5109. __pyx_t_6 = __pyx_t_7;
  5110. goto __pyx_L7_bool_binop_done;
  5111. }
  5112. __pyx_L8_next_or:;
  5113. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":859
  5114. *
  5115. * if ((child.byteorder == c'>' and little_endian) or
  5116. * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
  5117. * raise ValueError(u"Non-native byte order not supported")
  5118. * # One could encode it in the format string and have Cython
  5119. */
  5120. __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
  5121. if (__pyx_t_7) {
  5122. } else {
  5123. __pyx_t_6 = __pyx_t_7;
  5124. goto __pyx_L7_bool_binop_done;
  5125. }
  5126. __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
  5127. __pyx_t_6 = __pyx_t_7;
  5128. __pyx_L7_bool_binop_done:;
  5129. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858
  5130. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  5131. *
  5132. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  5133. * (child.byteorder == c'<' and not little_endian)):
  5134. * raise ValueError(u"Non-native byte order not supported")
  5135. */
  5136. if (unlikely(__pyx_t_6)) {
  5137. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":860
  5138. * if ((child.byteorder == c'>' and little_endian) or
  5139. * (child.byteorder == c'<' and not little_endian)):
  5140. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  5141. * # One could encode it in the format string and have Cython
  5142. * # complain instead, BUT: < and > in format strings also imply
  5143. */
  5144. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 860, __pyx_L1_error)
  5145. __Pyx_GOTREF(__pyx_t_3);
  5146. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  5147. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5148. __PYX_ERR(1, 860, __pyx_L1_error)
  5149. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":858
  5150. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
  5151. *
  5152. * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
  5153. * (child.byteorder == c'<' and not little_endian)):
  5154. * raise ValueError(u"Non-native byte order not supported")
  5155. */
  5156. }
  5157. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":870
  5158. *
  5159. * # Output padding bytes
  5160. * while offset[0] < new_offset: # <<<<<<<<<<<<<<
  5161. * f[0] = 120 # "x"; pad byte
  5162. * f += 1
  5163. */
  5164. while (1) {
  5165. __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 870, __pyx_L1_error)
  5166. __Pyx_GOTREF(__pyx_t_3);
  5167. __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 870, __pyx_L1_error)
  5168. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5169. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 870, __pyx_L1_error)
  5170. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5171. if (!__pyx_t_6) break;
  5172. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":871
  5173. * # Output padding bytes
  5174. * while offset[0] < new_offset:
  5175. * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
  5176. * f += 1
  5177. * offset[0] += 1
  5178. */
  5179. (__pyx_v_f[0]) = 0x78;
  5180. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":872
  5181. * while offset[0] < new_offset:
  5182. * f[0] = 120 # "x"; pad byte
  5183. * f += 1 # <<<<<<<<<<<<<<
  5184. * offset[0] += 1
  5185. *
  5186. */
  5187. __pyx_v_f = (__pyx_v_f + 1);
  5188. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":873
  5189. * f[0] = 120 # "x"; pad byte
  5190. * f += 1
  5191. * offset[0] += 1 # <<<<<<<<<<<<<<
  5192. *
  5193. * offset[0] += child.itemsize
  5194. */
  5195. __pyx_t_8 = 0;
  5196. (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
  5197. }
  5198. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":875
  5199. * offset[0] += 1
  5200. *
  5201. * offset[0] += child.itemsize # <<<<<<<<<<<<<<
  5202. *
  5203. * if not PyDataType_HASFIELDS(child):
  5204. */
  5205. __pyx_t_8 = 0;
  5206. (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
  5207. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":877
  5208. * offset[0] += child.itemsize
  5209. *
  5210. * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
  5211. * t = child.type_num
  5212. * if end - f < 5:
  5213. */
  5214. __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
  5215. if (__pyx_t_6) {
  5216. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":878
  5217. *
  5218. * if not PyDataType_HASFIELDS(child):
  5219. * t = child.type_num # <<<<<<<<<<<<<<
  5220. * if end - f < 5:
  5221. * raise RuntimeError(u"Format string allocated too short.")
  5222. */
  5223. __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 878, __pyx_L1_error)
  5224. __Pyx_GOTREF(__pyx_t_4);
  5225. __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
  5226. __pyx_t_4 = 0;
  5227. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":879
  5228. * if not PyDataType_HASFIELDS(child):
  5229. * t = child.type_num
  5230. * if end - f < 5: # <<<<<<<<<<<<<<
  5231. * raise RuntimeError(u"Format string allocated too short.")
  5232. *
  5233. */
  5234. __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
  5235. if (unlikely(__pyx_t_6)) {
  5236. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":880
  5237. * t = child.type_num
  5238. * if end - f < 5:
  5239. * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
  5240. *
  5241. * # Until ticket #99 is fixed, use integers to avoid warnings
  5242. */
  5243. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 880, __pyx_L1_error)
  5244. __Pyx_GOTREF(__pyx_t_4);
  5245. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  5246. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5247. __PYX_ERR(1, 880, __pyx_L1_error)
  5248. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":879
  5249. * if not PyDataType_HASFIELDS(child):
  5250. * t = child.type_num
  5251. * if end - f < 5: # <<<<<<<<<<<<<<
  5252. * raise RuntimeError(u"Format string allocated too short.")
  5253. *
  5254. */
  5255. }
  5256. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":883
  5257. *
  5258. * # Until ticket #99 is fixed, use integers to avoid warnings
  5259. * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
  5260. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  5261. * elif t == NPY_SHORT: f[0] = 104 #"h"
  5262. */
  5263. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 883, __pyx_L1_error)
  5264. __Pyx_GOTREF(__pyx_t_4);
  5265. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 883, __pyx_L1_error)
  5266. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5267. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 883, __pyx_L1_error)
  5268. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5269. if (__pyx_t_6) {
  5270. (__pyx_v_f[0]) = 98;
  5271. goto __pyx_L15;
  5272. }
  5273. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":884
  5274. * # Until ticket #99 is fixed, use integers to avoid warnings
  5275. * if t == NPY_BYTE: f[0] = 98 #"b"
  5276. * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
  5277. * elif t == NPY_SHORT: f[0] = 104 #"h"
  5278. * elif t == NPY_USHORT: f[0] = 72 #"H"
  5279. */
  5280. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 884, __pyx_L1_error)
  5281. __Pyx_GOTREF(__pyx_t_3);
  5282. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 884, __pyx_L1_error)
  5283. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5284. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 884, __pyx_L1_error)
  5285. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5286. if (__pyx_t_6) {
  5287. (__pyx_v_f[0]) = 66;
  5288. goto __pyx_L15;
  5289. }
  5290. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":885
  5291. * if t == NPY_BYTE: f[0] = 98 #"b"
  5292. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  5293. * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
  5294. * elif t == NPY_USHORT: f[0] = 72 #"H"
  5295. * elif t == NPY_INT: f[0] = 105 #"i"
  5296. */
  5297. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 885, __pyx_L1_error)
  5298. __Pyx_GOTREF(__pyx_t_4);
  5299. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 885, __pyx_L1_error)
  5300. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5301. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 885, __pyx_L1_error)
  5302. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5303. if (__pyx_t_6) {
  5304. (__pyx_v_f[0]) = 0x68;
  5305. goto __pyx_L15;
  5306. }
  5307. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":886
  5308. * elif t == NPY_UBYTE: f[0] = 66 #"B"
  5309. * elif t == NPY_SHORT: f[0] = 104 #"h"
  5310. * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
  5311. * elif t == NPY_INT: f[0] = 105 #"i"
  5312. * elif t == NPY_UINT: f[0] = 73 #"I"
  5313. */
  5314. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 886, __pyx_L1_error)
  5315. __Pyx_GOTREF(__pyx_t_3);
  5316. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 886, __pyx_L1_error)
  5317. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5318. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 886, __pyx_L1_error)
  5319. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5320. if (__pyx_t_6) {
  5321. (__pyx_v_f[0]) = 72;
  5322. goto __pyx_L15;
  5323. }
  5324. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":887
  5325. * elif t == NPY_SHORT: f[0] = 104 #"h"
  5326. * elif t == NPY_USHORT: f[0] = 72 #"H"
  5327. * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
  5328. * elif t == NPY_UINT: f[0] = 73 #"I"
  5329. * elif t == NPY_LONG: f[0] = 108 #"l"
  5330. */
  5331. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 887, __pyx_L1_error)
  5332. __Pyx_GOTREF(__pyx_t_4);
  5333. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 887, __pyx_L1_error)
  5334. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5335. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 887, __pyx_L1_error)
  5336. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5337. if (__pyx_t_6) {
  5338. (__pyx_v_f[0]) = 0x69;
  5339. goto __pyx_L15;
  5340. }
  5341. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":888
  5342. * elif t == NPY_USHORT: f[0] = 72 #"H"
  5343. * elif t == NPY_INT: f[0] = 105 #"i"
  5344. * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
  5345. * elif t == NPY_LONG: f[0] = 108 #"l"
  5346. * elif t == NPY_ULONG: f[0] = 76 #"L"
  5347. */
  5348. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 888, __pyx_L1_error)
  5349. __Pyx_GOTREF(__pyx_t_3);
  5350. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 888, __pyx_L1_error)
  5351. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5352. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 888, __pyx_L1_error)
  5353. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5354. if (__pyx_t_6) {
  5355. (__pyx_v_f[0]) = 73;
  5356. goto __pyx_L15;
  5357. }
  5358. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":889
  5359. * elif t == NPY_INT: f[0] = 105 #"i"
  5360. * elif t == NPY_UINT: f[0] = 73 #"I"
  5361. * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
  5362. * elif t == NPY_ULONG: f[0] = 76 #"L"
  5363. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  5364. */
  5365. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 889, __pyx_L1_error)
  5366. __Pyx_GOTREF(__pyx_t_4);
  5367. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 889, __pyx_L1_error)
  5368. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5369. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 889, __pyx_L1_error)
  5370. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5371. if (__pyx_t_6) {
  5372. (__pyx_v_f[0]) = 0x6C;
  5373. goto __pyx_L15;
  5374. }
  5375. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":890
  5376. * elif t == NPY_UINT: f[0] = 73 #"I"
  5377. * elif t == NPY_LONG: f[0] = 108 #"l"
  5378. * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
  5379. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  5380. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  5381. */
  5382. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 890, __pyx_L1_error)
  5383. __Pyx_GOTREF(__pyx_t_3);
  5384. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 890, __pyx_L1_error)
  5385. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5386. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 890, __pyx_L1_error)
  5387. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5388. if (__pyx_t_6) {
  5389. (__pyx_v_f[0]) = 76;
  5390. goto __pyx_L15;
  5391. }
  5392. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":891
  5393. * elif t == NPY_LONG: f[0] = 108 #"l"
  5394. * elif t == NPY_ULONG: f[0] = 76 #"L"
  5395. * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
  5396. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  5397. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  5398. */
  5399. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 891, __pyx_L1_error)
  5400. __Pyx_GOTREF(__pyx_t_4);
  5401. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 891, __pyx_L1_error)
  5402. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5403. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 891, __pyx_L1_error)
  5404. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5405. if (__pyx_t_6) {
  5406. (__pyx_v_f[0]) = 0x71;
  5407. goto __pyx_L15;
  5408. }
  5409. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":892
  5410. * elif t == NPY_ULONG: f[0] = 76 #"L"
  5411. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  5412. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
  5413. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  5414. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  5415. */
  5416. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 892, __pyx_L1_error)
  5417. __Pyx_GOTREF(__pyx_t_3);
  5418. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 892, __pyx_L1_error)
  5419. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5420. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 892, __pyx_L1_error)
  5421. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5422. if (__pyx_t_6) {
  5423. (__pyx_v_f[0]) = 81;
  5424. goto __pyx_L15;
  5425. }
  5426. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":893
  5427. * elif t == NPY_LONGLONG: f[0] = 113 #"q"
  5428. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  5429. * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
  5430. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  5431. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  5432. */
  5433. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 893, __pyx_L1_error)
  5434. __Pyx_GOTREF(__pyx_t_4);
  5435. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 893, __pyx_L1_error)
  5436. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5437. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 893, __pyx_L1_error)
  5438. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5439. if (__pyx_t_6) {
  5440. (__pyx_v_f[0]) = 0x66;
  5441. goto __pyx_L15;
  5442. }
  5443. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":894
  5444. * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
  5445. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  5446. * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
  5447. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  5448. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  5449. */
  5450. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 894, __pyx_L1_error)
  5451. __Pyx_GOTREF(__pyx_t_3);
  5452. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 894, __pyx_L1_error)
  5453. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5454. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 894, __pyx_L1_error)
  5455. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5456. if (__pyx_t_6) {
  5457. (__pyx_v_f[0]) = 0x64;
  5458. goto __pyx_L15;
  5459. }
  5460. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":895
  5461. * elif t == NPY_FLOAT: f[0] = 102 #"f"
  5462. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  5463. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
  5464. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  5465. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  5466. */
  5467. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 895, __pyx_L1_error)
  5468. __Pyx_GOTREF(__pyx_t_4);
  5469. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 895, __pyx_L1_error)
  5470. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5471. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 895, __pyx_L1_error)
  5472. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5473. if (__pyx_t_6) {
  5474. (__pyx_v_f[0]) = 0x67;
  5475. goto __pyx_L15;
  5476. }
  5477. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":896
  5478. * elif t == NPY_DOUBLE: f[0] = 100 #"d"
  5479. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  5480. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
  5481. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  5482. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  5483. */
  5484. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 896, __pyx_L1_error)
  5485. __Pyx_GOTREF(__pyx_t_3);
  5486. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 896, __pyx_L1_error)
  5487. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5488. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 896, __pyx_L1_error)
  5489. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5490. if (__pyx_t_6) {
  5491. (__pyx_v_f[0]) = 90;
  5492. (__pyx_v_f[1]) = 0x66;
  5493. __pyx_v_f = (__pyx_v_f + 1);
  5494. goto __pyx_L15;
  5495. }
  5496. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":897
  5497. * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
  5498. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  5499. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
  5500. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  5501. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  5502. */
  5503. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 897, __pyx_L1_error)
  5504. __Pyx_GOTREF(__pyx_t_4);
  5505. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 897, __pyx_L1_error)
  5506. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5507. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 897, __pyx_L1_error)
  5508. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5509. if (__pyx_t_6) {
  5510. (__pyx_v_f[0]) = 90;
  5511. (__pyx_v_f[1]) = 0x64;
  5512. __pyx_v_f = (__pyx_v_f + 1);
  5513. goto __pyx_L15;
  5514. }
  5515. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":898
  5516. * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
  5517. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  5518. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
  5519. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  5520. * else:
  5521. */
  5522. __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 898, __pyx_L1_error)
  5523. __Pyx_GOTREF(__pyx_t_3);
  5524. __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 898, __pyx_L1_error)
  5525. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5526. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 898, __pyx_L1_error)
  5527. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5528. if (__pyx_t_6) {
  5529. (__pyx_v_f[0]) = 90;
  5530. (__pyx_v_f[1]) = 0x67;
  5531. __pyx_v_f = (__pyx_v_f + 1);
  5532. goto __pyx_L15;
  5533. }
  5534. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":899
  5535. * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
  5536. * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
  5537. * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
  5538. * else:
  5539. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5540. */
  5541. __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 899, __pyx_L1_error)
  5542. __Pyx_GOTREF(__pyx_t_4);
  5543. __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 899, __pyx_L1_error)
  5544. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5545. __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 899, __pyx_L1_error)
  5546. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5547. if (likely(__pyx_t_6)) {
  5548. (__pyx_v_f[0]) = 79;
  5549. goto __pyx_L15;
  5550. }
  5551. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":901
  5552. * elif t == NPY_OBJECT: f[0] = 79 #"O"
  5553. * else:
  5554. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
  5555. * f += 1
  5556. * else:
  5557. */
  5558. /*else*/ {
  5559. __pyx_t_3 = __Pyx_PyUnicode_FormatSafe(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 901, __pyx_L1_error)
  5560. __Pyx_GOTREF(__pyx_t_3);
  5561. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 901, __pyx_L1_error)
  5562. __Pyx_GOTREF(__pyx_t_4);
  5563. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  5564. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  5565. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  5566. __PYX_ERR(1, 901, __pyx_L1_error)
  5567. }
  5568. __pyx_L15:;
  5569. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":902
  5570. * else:
  5571. * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
  5572. * f += 1 # <<<<<<<<<<<<<<
  5573. * else:
  5574. * # Cython ignores struct boundary information ("T{...}"),
  5575. */
  5576. __pyx_v_f = (__pyx_v_f + 1);
  5577. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":877
  5578. * offset[0] += child.itemsize
  5579. *
  5580. * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
  5581. * t = child.type_num
  5582. * if end - f < 5:
  5583. */
  5584. goto __pyx_L13;
  5585. }
  5586. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":906
  5587. * # Cython ignores struct boundary information ("T{...}"),
  5588. * # so don't output it
  5589. * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
  5590. * return f
  5591. *
  5592. */
  5593. /*else*/ {
  5594. __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == ((char *)NULL))) __PYX_ERR(1, 906, __pyx_L1_error)
  5595. __pyx_v_f = __pyx_t_9;
  5596. }
  5597. __pyx_L13:;
  5598. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":851
  5599. * cdef tuple fields
  5600. *
  5601. * for childname in descr.names: # <<<<<<<<<<<<<<
  5602. * fields = descr.fields[childname]
  5603. * child, new_offset = fields
  5604. */
  5605. }
  5606. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  5607. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":907
  5608. * # so don't output it
  5609. * f = _util_dtypestring(child, f, end, offset)
  5610. * return f # <<<<<<<<<<<<<<
  5611. *
  5612. *
  5613. */
  5614. __pyx_r = __pyx_v_f;
  5615. goto __pyx_L0;
  5616. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":842
  5617. * return ()
  5618. *
  5619. * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
  5620. * # Recursive utility function used in __getbuffer__ to get format
  5621. * # string. The new location in the format string is returned.
  5622. */
  5623. /* function exit code */
  5624. __pyx_L1_error:;
  5625. __Pyx_XDECREF(__pyx_t_1);
  5626. __Pyx_XDECREF(__pyx_t_3);
  5627. __Pyx_XDECREF(__pyx_t_4);
  5628. __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5629. __pyx_r = NULL;
  5630. __pyx_L0:;
  5631. __Pyx_XDECREF((PyObject *)__pyx_v_child);
  5632. __Pyx_XDECREF(__pyx_v_fields);
  5633. __Pyx_XDECREF(__pyx_v_childname);
  5634. __Pyx_XDECREF(__pyx_v_new_offset);
  5635. __Pyx_XDECREF(__pyx_v_t);
  5636. __Pyx_RefNannyFinishContext();
  5637. return __pyx_r;
  5638. }
  5639. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1022
  5640. * int _import_umath() except -1
  5641. *
  5642. * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
  5643. * Py_INCREF(base) # important to do this before stealing the reference below!
  5644. * PyArray_SetBaseObject(arr, base)
  5645. */
  5646. static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
  5647. __Pyx_RefNannyDeclarations
  5648. __Pyx_RefNannySetupContext("set_array_base", 0);
  5649. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1023
  5650. *
  5651. * cdef inline void set_array_base(ndarray arr, object base):
  5652. * Py_INCREF(base) # important to do this before stealing the reference below! # <<<<<<<<<<<<<<
  5653. * PyArray_SetBaseObject(arr, base)
  5654. *
  5655. */
  5656. Py_INCREF(__pyx_v_base);
  5657. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1024
  5658. * cdef inline void set_array_base(ndarray arr, object base):
  5659. * Py_INCREF(base) # important to do this before stealing the reference below!
  5660. * PyArray_SetBaseObject(arr, base) # <<<<<<<<<<<<<<
  5661. *
  5662. * cdef inline object get_array_base(ndarray arr):
  5663. */
  5664. (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
  5665. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1022
  5666. * int _import_umath() except -1
  5667. *
  5668. * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
  5669. * Py_INCREF(base) # important to do this before stealing the reference below!
  5670. * PyArray_SetBaseObject(arr, base)
  5671. */
  5672. /* function exit code */
  5673. __Pyx_RefNannyFinishContext();
  5674. }
  5675. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1026
  5676. * PyArray_SetBaseObject(arr, base)
  5677. *
  5678. * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
  5679. * base = PyArray_BASE(arr)
  5680. * if base is NULL:
  5681. */
  5682. static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
  5683. PyObject *__pyx_v_base;
  5684. PyObject *__pyx_r = NULL;
  5685. __Pyx_RefNannyDeclarations
  5686. int __pyx_t_1;
  5687. __Pyx_RefNannySetupContext("get_array_base", 0);
  5688. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1027
  5689. *
  5690. * cdef inline object get_array_base(ndarray arr):
  5691. * base = PyArray_BASE(arr) # <<<<<<<<<<<<<<
  5692. * if base is NULL:
  5693. * return None
  5694. */
  5695. __pyx_v_base = PyArray_BASE(__pyx_v_arr);
  5696. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1028
  5697. * cdef inline object get_array_base(ndarray arr):
  5698. * base = PyArray_BASE(arr)
  5699. * if base is NULL: # <<<<<<<<<<<<<<
  5700. * return None
  5701. * return <object>base
  5702. */
  5703. __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
  5704. if (__pyx_t_1) {
  5705. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1029
  5706. * base = PyArray_BASE(arr)
  5707. * if base is NULL:
  5708. * return None # <<<<<<<<<<<<<<
  5709. * return <object>base
  5710. *
  5711. */
  5712. __Pyx_XDECREF(__pyx_r);
  5713. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  5714. goto __pyx_L0;
  5715. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1028
  5716. * cdef inline object get_array_base(ndarray arr):
  5717. * base = PyArray_BASE(arr)
  5718. * if base is NULL: # <<<<<<<<<<<<<<
  5719. * return None
  5720. * return <object>base
  5721. */
  5722. }
  5723. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1030
  5724. * if base is NULL:
  5725. * return None
  5726. * return <object>base # <<<<<<<<<<<<<<
  5727. *
  5728. * # Versions of the import_* functions which are more suitable for
  5729. */
  5730. __Pyx_XDECREF(__pyx_r);
  5731. __Pyx_INCREF(((PyObject *)__pyx_v_base));
  5732. __pyx_r = ((PyObject *)__pyx_v_base);
  5733. goto __pyx_L0;
  5734. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1026
  5735. * PyArray_SetBaseObject(arr, base)
  5736. *
  5737. * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
  5738. * base = PyArray_BASE(arr)
  5739. * if base is NULL:
  5740. */
  5741. /* function exit code */
  5742. __pyx_L0:;
  5743. __Pyx_XGIVEREF(__pyx_r);
  5744. __Pyx_RefNannyFinishContext();
  5745. return __pyx_r;
  5746. }
  5747. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1034
  5748. * # Versions of the import_* functions which are more suitable for
  5749. * # Cython code.
  5750. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
  5751. * try:
  5752. * _import_array()
  5753. */
  5754. static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  5755. int __pyx_r;
  5756. __Pyx_RefNannyDeclarations
  5757. PyObject *__pyx_t_1 = NULL;
  5758. PyObject *__pyx_t_2 = NULL;
  5759. PyObject *__pyx_t_3 = NULL;
  5760. int __pyx_t_4;
  5761. PyObject *__pyx_t_5 = NULL;
  5762. PyObject *__pyx_t_6 = NULL;
  5763. PyObject *__pyx_t_7 = NULL;
  5764. PyObject *__pyx_t_8 = NULL;
  5765. __Pyx_RefNannySetupContext("import_array", 0);
  5766. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035
  5767. * # Cython code.
  5768. * cdef inline int import_array() except -1:
  5769. * try: # <<<<<<<<<<<<<<
  5770. * _import_array()
  5771. * except Exception:
  5772. */
  5773. {
  5774. __Pyx_PyThreadState_declare
  5775. __Pyx_PyThreadState_assign
  5776. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  5777. __Pyx_XGOTREF(__pyx_t_1);
  5778. __Pyx_XGOTREF(__pyx_t_2);
  5779. __Pyx_XGOTREF(__pyx_t_3);
  5780. /*try:*/ {
  5781. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1036
  5782. * cdef inline int import_array() except -1:
  5783. * try:
  5784. * _import_array() # <<<<<<<<<<<<<<
  5785. * except Exception:
  5786. * raise ImportError("numpy.core.multiarray failed to import")
  5787. */
  5788. __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1036, __pyx_L3_error)
  5789. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035
  5790. * # Cython code.
  5791. * cdef inline int import_array() except -1:
  5792. * try: # <<<<<<<<<<<<<<
  5793. * _import_array()
  5794. * except Exception:
  5795. */
  5796. }
  5797. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  5798. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5799. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  5800. goto __pyx_L8_try_end;
  5801. __pyx_L3_error:;
  5802. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1037
  5803. * try:
  5804. * _import_array()
  5805. * except Exception: # <<<<<<<<<<<<<<
  5806. * raise ImportError("numpy.core.multiarray failed to import")
  5807. *
  5808. */
  5809. __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  5810. if (__pyx_t_4) {
  5811. __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5812. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1037, __pyx_L5_except_error)
  5813. __Pyx_GOTREF(__pyx_t_5);
  5814. __Pyx_GOTREF(__pyx_t_6);
  5815. __Pyx_GOTREF(__pyx_t_7);
  5816. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1038
  5817. * _import_array()
  5818. * except Exception:
  5819. * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
  5820. *
  5821. * cdef inline int import_umath() except -1:
  5822. */
  5823. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1038, __pyx_L5_except_error)
  5824. __Pyx_GOTREF(__pyx_t_8);
  5825. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  5826. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  5827. __PYX_ERR(1, 1038, __pyx_L5_except_error)
  5828. }
  5829. goto __pyx_L5_except_error;
  5830. __pyx_L5_except_error:;
  5831. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1035
  5832. * # Cython code.
  5833. * cdef inline int import_array() except -1:
  5834. * try: # <<<<<<<<<<<<<<
  5835. * _import_array()
  5836. * except Exception:
  5837. */
  5838. __Pyx_XGIVEREF(__pyx_t_1);
  5839. __Pyx_XGIVEREF(__pyx_t_2);
  5840. __Pyx_XGIVEREF(__pyx_t_3);
  5841. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  5842. goto __pyx_L1_error;
  5843. __pyx_L8_try_end:;
  5844. }
  5845. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1034
  5846. * # Versions of the import_* functions which are more suitable for
  5847. * # Cython code.
  5848. * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
  5849. * try:
  5850. * _import_array()
  5851. */
  5852. /* function exit code */
  5853. __pyx_r = 0;
  5854. goto __pyx_L0;
  5855. __pyx_L1_error:;
  5856. __Pyx_XDECREF(__pyx_t_5);
  5857. __Pyx_XDECREF(__pyx_t_6);
  5858. __Pyx_XDECREF(__pyx_t_7);
  5859. __Pyx_XDECREF(__pyx_t_8);
  5860. __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5861. __pyx_r = -1;
  5862. __pyx_L0:;
  5863. __Pyx_RefNannyFinishContext();
  5864. return __pyx_r;
  5865. }
  5866. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1040
  5867. * raise ImportError("numpy.core.multiarray failed to import")
  5868. *
  5869. * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
  5870. * try:
  5871. * _import_umath()
  5872. */
  5873. static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  5874. int __pyx_r;
  5875. __Pyx_RefNannyDeclarations
  5876. PyObject *__pyx_t_1 = NULL;
  5877. PyObject *__pyx_t_2 = NULL;
  5878. PyObject *__pyx_t_3 = NULL;
  5879. int __pyx_t_4;
  5880. PyObject *__pyx_t_5 = NULL;
  5881. PyObject *__pyx_t_6 = NULL;
  5882. PyObject *__pyx_t_7 = NULL;
  5883. PyObject *__pyx_t_8 = NULL;
  5884. __Pyx_RefNannySetupContext("import_umath", 0);
  5885. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041
  5886. *
  5887. * cdef inline int import_umath() except -1:
  5888. * try: # <<<<<<<<<<<<<<
  5889. * _import_umath()
  5890. * except Exception:
  5891. */
  5892. {
  5893. __Pyx_PyThreadState_declare
  5894. __Pyx_PyThreadState_assign
  5895. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  5896. __Pyx_XGOTREF(__pyx_t_1);
  5897. __Pyx_XGOTREF(__pyx_t_2);
  5898. __Pyx_XGOTREF(__pyx_t_3);
  5899. /*try:*/ {
  5900. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1042
  5901. * cdef inline int import_umath() except -1:
  5902. * try:
  5903. * _import_umath() # <<<<<<<<<<<<<<
  5904. * except Exception:
  5905. * raise ImportError("numpy.core.umath failed to import")
  5906. */
  5907. __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1042, __pyx_L3_error)
  5908. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041
  5909. *
  5910. * cdef inline int import_umath() except -1:
  5911. * try: # <<<<<<<<<<<<<<
  5912. * _import_umath()
  5913. * except Exception:
  5914. */
  5915. }
  5916. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  5917. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  5918. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  5919. goto __pyx_L8_try_end;
  5920. __pyx_L3_error:;
  5921. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1043
  5922. * try:
  5923. * _import_umath()
  5924. * except Exception: # <<<<<<<<<<<<<<
  5925. * raise ImportError("numpy.core.umath failed to import")
  5926. *
  5927. */
  5928. __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  5929. if (__pyx_t_4) {
  5930. __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5931. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1043, __pyx_L5_except_error)
  5932. __Pyx_GOTREF(__pyx_t_5);
  5933. __Pyx_GOTREF(__pyx_t_6);
  5934. __Pyx_GOTREF(__pyx_t_7);
  5935. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1044
  5936. * _import_umath()
  5937. * except Exception:
  5938. * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
  5939. *
  5940. * cdef inline int import_ufunc() except -1:
  5941. */
  5942. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1044, __pyx_L5_except_error)
  5943. __Pyx_GOTREF(__pyx_t_8);
  5944. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  5945. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  5946. __PYX_ERR(1, 1044, __pyx_L5_except_error)
  5947. }
  5948. goto __pyx_L5_except_error;
  5949. __pyx_L5_except_error:;
  5950. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1041
  5951. *
  5952. * cdef inline int import_umath() except -1:
  5953. * try: # <<<<<<<<<<<<<<
  5954. * _import_umath()
  5955. * except Exception:
  5956. */
  5957. __Pyx_XGIVEREF(__pyx_t_1);
  5958. __Pyx_XGIVEREF(__pyx_t_2);
  5959. __Pyx_XGIVEREF(__pyx_t_3);
  5960. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  5961. goto __pyx_L1_error;
  5962. __pyx_L8_try_end:;
  5963. }
  5964. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1040
  5965. * raise ImportError("numpy.core.multiarray failed to import")
  5966. *
  5967. * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
  5968. * try:
  5969. * _import_umath()
  5970. */
  5971. /* function exit code */
  5972. __pyx_r = 0;
  5973. goto __pyx_L0;
  5974. __pyx_L1_error:;
  5975. __Pyx_XDECREF(__pyx_t_5);
  5976. __Pyx_XDECREF(__pyx_t_6);
  5977. __Pyx_XDECREF(__pyx_t_7);
  5978. __Pyx_XDECREF(__pyx_t_8);
  5979. __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
  5980. __pyx_r = -1;
  5981. __pyx_L0:;
  5982. __Pyx_RefNannyFinishContext();
  5983. return __pyx_r;
  5984. }
  5985. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1046
  5986. * raise ImportError("numpy.core.umath failed to import")
  5987. *
  5988. * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
  5989. * try:
  5990. * _import_umath()
  5991. */
  5992. static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  5993. int __pyx_r;
  5994. __Pyx_RefNannyDeclarations
  5995. PyObject *__pyx_t_1 = NULL;
  5996. PyObject *__pyx_t_2 = NULL;
  5997. PyObject *__pyx_t_3 = NULL;
  5998. int __pyx_t_4;
  5999. PyObject *__pyx_t_5 = NULL;
  6000. PyObject *__pyx_t_6 = NULL;
  6001. PyObject *__pyx_t_7 = NULL;
  6002. PyObject *__pyx_t_8 = NULL;
  6003. __Pyx_RefNannySetupContext("import_ufunc", 0);
  6004. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047
  6005. *
  6006. * cdef inline int import_ufunc() except -1:
  6007. * try: # <<<<<<<<<<<<<<
  6008. * _import_umath()
  6009. * except Exception:
  6010. */
  6011. {
  6012. __Pyx_PyThreadState_declare
  6013. __Pyx_PyThreadState_assign
  6014. __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
  6015. __Pyx_XGOTREF(__pyx_t_1);
  6016. __Pyx_XGOTREF(__pyx_t_2);
  6017. __Pyx_XGOTREF(__pyx_t_3);
  6018. /*try:*/ {
  6019. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1048
  6020. * cdef inline int import_ufunc() except -1:
  6021. * try:
  6022. * _import_umath() # <<<<<<<<<<<<<<
  6023. * except Exception:
  6024. * raise ImportError("numpy.core.umath failed to import")
  6025. */
  6026. __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(1, 1048, __pyx_L3_error)
  6027. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047
  6028. *
  6029. * cdef inline int import_ufunc() except -1:
  6030. * try: # <<<<<<<<<<<<<<
  6031. * _import_umath()
  6032. * except Exception:
  6033. */
  6034. }
  6035. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  6036. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  6037. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  6038. goto __pyx_L8_try_end;
  6039. __pyx_L3_error:;
  6040. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1049
  6041. * try:
  6042. * _import_umath()
  6043. * except Exception: # <<<<<<<<<<<<<<
  6044. * raise ImportError("numpy.core.umath failed to import")
  6045. */
  6046. __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
  6047. if (__pyx_t_4) {
  6048. __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6049. if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1049, __pyx_L5_except_error)
  6050. __Pyx_GOTREF(__pyx_t_5);
  6051. __Pyx_GOTREF(__pyx_t_6);
  6052. __Pyx_GOTREF(__pyx_t_7);
  6053. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1050
  6054. * _import_umath()
  6055. * except Exception:
  6056. * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
  6057. */
  6058. __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1050, __pyx_L5_except_error)
  6059. __Pyx_GOTREF(__pyx_t_8);
  6060. __Pyx_Raise(__pyx_t_8, 0, 0, 0);
  6061. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  6062. __PYX_ERR(1, 1050, __pyx_L5_except_error)
  6063. }
  6064. goto __pyx_L5_except_error;
  6065. __pyx_L5_except_error:;
  6066. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1047
  6067. *
  6068. * cdef inline int import_ufunc() except -1:
  6069. * try: # <<<<<<<<<<<<<<
  6070. * _import_umath()
  6071. * except Exception:
  6072. */
  6073. __Pyx_XGIVEREF(__pyx_t_1);
  6074. __Pyx_XGIVEREF(__pyx_t_2);
  6075. __Pyx_XGIVEREF(__pyx_t_3);
  6076. __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
  6077. goto __pyx_L1_error;
  6078. __pyx_L8_try_end:;
  6079. }
  6080. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1046
  6081. * raise ImportError("numpy.core.umath failed to import")
  6082. *
  6083. * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
  6084. * try:
  6085. * _import_umath()
  6086. */
  6087. /* function exit code */
  6088. __pyx_r = 0;
  6089. goto __pyx_L0;
  6090. __pyx_L1_error:;
  6091. __Pyx_XDECREF(__pyx_t_5);
  6092. __Pyx_XDECREF(__pyx_t_6);
  6093. __Pyx_XDECREF(__pyx_t_7);
  6094. __Pyx_XDECREF(__pyx_t_8);
  6095. __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6096. __pyx_r = -1;
  6097. __pyx_L0:;
  6098. __Pyx_RefNannyFinishContext();
  6099. return __pyx_r;
  6100. }
  6101. /* "View.MemoryView":122
  6102. * cdef bint dtype_is_object
  6103. *
  6104. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  6105. * mode="c", bint allocate_buffer=True):
  6106. *
  6107. */
  6108. /* Python wrapper */
  6109. static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  6110. static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  6111. PyObject *__pyx_v_shape = 0;
  6112. Py_ssize_t __pyx_v_itemsize;
  6113. PyObject *__pyx_v_format = 0;
  6114. PyObject *__pyx_v_mode = 0;
  6115. int __pyx_v_allocate_buffer;
  6116. int __pyx_r;
  6117. __Pyx_RefNannyDeclarations
  6118. __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  6119. {
  6120. 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};
  6121. PyObject* values[5] = {0,0,0,0,0};
  6122. values[3] = ((PyObject *)__pyx_n_s_c);
  6123. if (unlikely(__pyx_kwds)) {
  6124. Py_ssize_t kw_args;
  6125. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  6126. switch (pos_args) {
  6127. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  6128. CYTHON_FALLTHROUGH;
  6129. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  6130. CYTHON_FALLTHROUGH;
  6131. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  6132. CYTHON_FALLTHROUGH;
  6133. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6134. CYTHON_FALLTHROUGH;
  6135. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6136. CYTHON_FALLTHROUGH;
  6137. case 0: break;
  6138. default: goto __pyx_L5_argtuple_error;
  6139. }
  6140. kw_args = PyDict_Size(__pyx_kwds);
  6141. switch (pos_args) {
  6142. case 0:
  6143. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
  6144. else goto __pyx_L5_argtuple_error;
  6145. CYTHON_FALLTHROUGH;
  6146. case 1:
  6147. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
  6148. else {
  6149. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 122, __pyx_L3_error)
  6150. }
  6151. CYTHON_FALLTHROUGH;
  6152. case 2:
  6153. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
  6154. else {
  6155. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 122, __pyx_L3_error)
  6156. }
  6157. CYTHON_FALLTHROUGH;
  6158. case 3:
  6159. if (kw_args > 0) {
  6160. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
  6161. if (value) { values[3] = value; kw_args--; }
  6162. }
  6163. CYTHON_FALLTHROUGH;
  6164. case 4:
  6165. if (kw_args > 0) {
  6166. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
  6167. if (value) { values[4] = value; kw_args--; }
  6168. }
  6169. }
  6170. if (unlikely(kw_args > 0)) {
  6171. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 122, __pyx_L3_error)
  6172. }
  6173. } else {
  6174. switch (PyTuple_GET_SIZE(__pyx_args)) {
  6175. case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
  6176. CYTHON_FALLTHROUGH;
  6177. case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
  6178. CYTHON_FALLTHROUGH;
  6179. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  6180. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  6181. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  6182. break;
  6183. default: goto __pyx_L5_argtuple_error;
  6184. }
  6185. }
  6186. __pyx_v_shape = ((PyObject*)values[0]);
  6187. __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 122, __pyx_L3_error)
  6188. __pyx_v_format = values[2];
  6189. __pyx_v_mode = values[3];
  6190. if (values[4]) {
  6191. __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_allocate_buffer == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
  6192. } else {
  6193. /* "View.MemoryView":123
  6194. *
  6195. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None,
  6196. * mode="c", bint allocate_buffer=True): # <<<<<<<<<<<<<<
  6197. *
  6198. * cdef int idx
  6199. */
  6200. __pyx_v_allocate_buffer = ((int)1);
  6201. }
  6202. }
  6203. goto __pyx_L4_argument_unpacking_done;
  6204. __pyx_L5_argtuple_error:;
  6205. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 122, __pyx_L3_error)
  6206. __pyx_L3_error:;
  6207. __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6208. __Pyx_RefNannyFinishContext();
  6209. return -1;
  6210. __pyx_L4_argument_unpacking_done:;
  6211. if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1, "shape", 1))) __PYX_ERR(2, 122, __pyx_L1_error)
  6212. if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
  6213. PyErr_Format(PyExc_TypeError, "Argument '%.200s' must not be None", "format"); __PYX_ERR(2, 122, __pyx_L1_error)
  6214. }
  6215. __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);
  6216. /* "View.MemoryView":122
  6217. * cdef bint dtype_is_object
  6218. *
  6219. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  6220. * mode="c", bint allocate_buffer=True):
  6221. *
  6222. */
  6223. /* function exit code */
  6224. goto __pyx_L0;
  6225. __pyx_L1_error:;
  6226. __pyx_r = -1;
  6227. __pyx_L0:;
  6228. __Pyx_RefNannyFinishContext();
  6229. return __pyx_r;
  6230. }
  6231. 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) {
  6232. int __pyx_v_idx;
  6233. Py_ssize_t __pyx_v_i;
  6234. Py_ssize_t __pyx_v_dim;
  6235. PyObject **__pyx_v_p;
  6236. char __pyx_v_order;
  6237. int __pyx_r;
  6238. __Pyx_RefNannyDeclarations
  6239. Py_ssize_t __pyx_t_1;
  6240. int __pyx_t_2;
  6241. PyObject *__pyx_t_3 = NULL;
  6242. int __pyx_t_4;
  6243. PyObject *__pyx_t_5 = NULL;
  6244. PyObject *__pyx_t_6 = NULL;
  6245. char *__pyx_t_7;
  6246. int __pyx_t_8;
  6247. Py_ssize_t __pyx_t_9;
  6248. PyObject *__pyx_t_10 = NULL;
  6249. Py_ssize_t __pyx_t_11;
  6250. __Pyx_RefNannySetupContext("__cinit__", 0);
  6251. __Pyx_INCREF(__pyx_v_format);
  6252. /* "View.MemoryView":129
  6253. * cdef PyObject **p
  6254. *
  6255. * self.ndim = <int> len(shape) # <<<<<<<<<<<<<<
  6256. * self.itemsize = itemsize
  6257. *
  6258. */
  6259. if (unlikely(__pyx_v_shape == Py_None)) {
  6260. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  6261. __PYX_ERR(2, 129, __pyx_L1_error)
  6262. }
  6263. __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 129, __pyx_L1_error)
  6264. __pyx_v_self->ndim = ((int)__pyx_t_1);
  6265. /* "View.MemoryView":130
  6266. *
  6267. * self.ndim = <int> len(shape)
  6268. * self.itemsize = itemsize # <<<<<<<<<<<<<<
  6269. *
  6270. * if not self.ndim:
  6271. */
  6272. __pyx_v_self->itemsize = __pyx_v_itemsize;
  6273. /* "View.MemoryView":132
  6274. * self.itemsize = itemsize
  6275. *
  6276. * if not self.ndim: # <<<<<<<<<<<<<<
  6277. * raise ValueError("Empty shape tuple for cython.array")
  6278. *
  6279. */
  6280. __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
  6281. if (unlikely(__pyx_t_2)) {
  6282. /* "View.MemoryView":133
  6283. *
  6284. * if not self.ndim:
  6285. * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
  6286. *
  6287. * if itemsize <= 0:
  6288. */
  6289. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 133, __pyx_L1_error)
  6290. __Pyx_GOTREF(__pyx_t_3);
  6291. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6292. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6293. __PYX_ERR(2, 133, __pyx_L1_error)
  6294. /* "View.MemoryView":132
  6295. * self.itemsize = itemsize
  6296. *
  6297. * if not self.ndim: # <<<<<<<<<<<<<<
  6298. * raise ValueError("Empty shape tuple for cython.array")
  6299. *
  6300. */
  6301. }
  6302. /* "View.MemoryView":135
  6303. * raise ValueError("Empty shape tuple for cython.array")
  6304. *
  6305. * if itemsize <= 0: # <<<<<<<<<<<<<<
  6306. * raise ValueError("itemsize <= 0 for cython.array")
  6307. *
  6308. */
  6309. __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
  6310. if (unlikely(__pyx_t_2)) {
  6311. /* "View.MemoryView":136
  6312. *
  6313. * if itemsize <= 0:
  6314. * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
  6315. *
  6316. * if not isinstance(format, bytes):
  6317. */
  6318. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 136, __pyx_L1_error)
  6319. __Pyx_GOTREF(__pyx_t_3);
  6320. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6321. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6322. __PYX_ERR(2, 136, __pyx_L1_error)
  6323. /* "View.MemoryView":135
  6324. * raise ValueError("Empty shape tuple for cython.array")
  6325. *
  6326. * if itemsize <= 0: # <<<<<<<<<<<<<<
  6327. * raise ValueError("itemsize <= 0 for cython.array")
  6328. *
  6329. */
  6330. }
  6331. /* "View.MemoryView":138
  6332. * raise ValueError("itemsize <= 0 for cython.array")
  6333. *
  6334. * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
  6335. * format = format.encode('ASCII')
  6336. * self._format = format # keep a reference to the byte string
  6337. */
  6338. __pyx_t_2 = PyBytes_Check(__pyx_v_format);
  6339. __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
  6340. if (__pyx_t_4) {
  6341. /* "View.MemoryView":139
  6342. *
  6343. * if not isinstance(format, bytes):
  6344. * format = format.encode('ASCII') # <<<<<<<<<<<<<<
  6345. * self._format = format # keep a reference to the byte string
  6346. * self.format = self._format
  6347. */
  6348. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 139, __pyx_L1_error)
  6349. __Pyx_GOTREF(__pyx_t_5);
  6350. __pyx_t_6 = NULL;
  6351. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
  6352. __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
  6353. if (likely(__pyx_t_6)) {
  6354. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  6355. __Pyx_INCREF(__pyx_t_6);
  6356. __Pyx_INCREF(function);
  6357. __Pyx_DECREF_SET(__pyx_t_5, function);
  6358. }
  6359. }
  6360. __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);
  6361. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  6362. if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 139, __pyx_L1_error)
  6363. __Pyx_GOTREF(__pyx_t_3);
  6364. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6365. __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
  6366. __pyx_t_3 = 0;
  6367. /* "View.MemoryView":138
  6368. * raise ValueError("itemsize <= 0 for cython.array")
  6369. *
  6370. * if not isinstance(format, bytes): # <<<<<<<<<<<<<<
  6371. * format = format.encode('ASCII')
  6372. * self._format = format # keep a reference to the byte string
  6373. */
  6374. }
  6375. /* "View.MemoryView":140
  6376. * if not isinstance(format, bytes):
  6377. * format = format.encode('ASCII')
  6378. * self._format = format # keep a reference to the byte string # <<<<<<<<<<<<<<
  6379. * self.format = self._format
  6380. *
  6381. */
  6382. 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(2, 140, __pyx_L1_error)
  6383. __pyx_t_3 = __pyx_v_format;
  6384. __Pyx_INCREF(__pyx_t_3);
  6385. __Pyx_GIVEREF(__pyx_t_3);
  6386. __Pyx_GOTREF(__pyx_v_self->_format);
  6387. __Pyx_DECREF(__pyx_v_self->_format);
  6388. __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
  6389. __pyx_t_3 = 0;
  6390. /* "View.MemoryView":141
  6391. * format = format.encode('ASCII')
  6392. * self._format = format # keep a reference to the byte string
  6393. * self.format = self._format # <<<<<<<<<<<<<<
  6394. *
  6395. *
  6396. */
  6397. if (unlikely(__pyx_v_self->_format == Py_None)) {
  6398. PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
  6399. __PYX_ERR(2, 141, __pyx_L1_error)
  6400. }
  6401. __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 141, __pyx_L1_error)
  6402. __pyx_v_self->format = __pyx_t_7;
  6403. /* "View.MemoryView":144
  6404. *
  6405. *
  6406. * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2) # <<<<<<<<<<<<<<
  6407. * self._strides = self._shape + self.ndim
  6408. *
  6409. */
  6410. __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
  6411. /* "View.MemoryView":145
  6412. *
  6413. * self._shape = <Py_ssize_t *> PyObject_Malloc(sizeof(Py_ssize_t)*self.ndim*2)
  6414. * self._strides = self._shape + self.ndim # <<<<<<<<<<<<<<
  6415. *
  6416. * if not self._shape:
  6417. */
  6418. __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
  6419. /* "View.MemoryView":147
  6420. * self._strides = self._shape + self.ndim
  6421. *
  6422. * if not self._shape: # <<<<<<<<<<<<<<
  6423. * raise MemoryError("unable to allocate shape and strides.")
  6424. *
  6425. */
  6426. __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
  6427. if (unlikely(__pyx_t_4)) {
  6428. /* "View.MemoryView":148
  6429. *
  6430. * if not self._shape:
  6431. * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
  6432. *
  6433. *
  6434. */
  6435. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 148, __pyx_L1_error)
  6436. __Pyx_GOTREF(__pyx_t_3);
  6437. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6438. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6439. __PYX_ERR(2, 148, __pyx_L1_error)
  6440. /* "View.MemoryView":147
  6441. * self._strides = self._shape + self.ndim
  6442. *
  6443. * if not self._shape: # <<<<<<<<<<<<<<
  6444. * raise MemoryError("unable to allocate shape and strides.")
  6445. *
  6446. */
  6447. }
  6448. /* "View.MemoryView":151
  6449. *
  6450. *
  6451. * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
  6452. * if dim <= 0:
  6453. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  6454. */
  6455. __pyx_t_8 = 0;
  6456. __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
  6457. for (;;) {
  6458. if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  6459. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  6460. __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(2, 151, __pyx_L1_error)
  6461. #else
  6462. __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 151, __pyx_L1_error)
  6463. __Pyx_GOTREF(__pyx_t_5);
  6464. #endif
  6465. __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 151, __pyx_L1_error)
  6466. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  6467. __pyx_v_dim = __pyx_t_9;
  6468. __pyx_v_idx = __pyx_t_8;
  6469. __pyx_t_8 = (__pyx_t_8 + 1);
  6470. /* "View.MemoryView":152
  6471. *
  6472. * for idx, dim in enumerate(shape):
  6473. * if dim <= 0: # <<<<<<<<<<<<<<
  6474. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  6475. * self._shape[idx] = dim
  6476. */
  6477. __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
  6478. if (unlikely(__pyx_t_4)) {
  6479. /* "View.MemoryView":153
  6480. * for idx, dim in enumerate(shape):
  6481. * if dim <= 0:
  6482. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim)) # <<<<<<<<<<<<<<
  6483. * self._shape[idx] = dim
  6484. *
  6485. */
  6486. __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 153, __pyx_L1_error)
  6487. __Pyx_GOTREF(__pyx_t_5);
  6488. __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 153, __pyx_L1_error)
  6489. __Pyx_GOTREF(__pyx_t_6);
  6490. __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
  6491. __Pyx_GOTREF(__pyx_t_10);
  6492. __Pyx_GIVEREF(__pyx_t_5);
  6493. PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
  6494. __Pyx_GIVEREF(__pyx_t_6);
  6495. PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
  6496. __pyx_t_5 = 0;
  6497. __pyx_t_6 = 0;
  6498. __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(2, 153, __pyx_L1_error)
  6499. __Pyx_GOTREF(__pyx_t_6);
  6500. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  6501. __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 153, __pyx_L1_error)
  6502. __Pyx_GOTREF(__pyx_t_10);
  6503. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  6504. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  6505. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  6506. __PYX_ERR(2, 153, __pyx_L1_error)
  6507. /* "View.MemoryView":152
  6508. *
  6509. * for idx, dim in enumerate(shape):
  6510. * if dim <= 0: # <<<<<<<<<<<<<<
  6511. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  6512. * self._shape[idx] = dim
  6513. */
  6514. }
  6515. /* "View.MemoryView":154
  6516. * if dim <= 0:
  6517. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  6518. * self._shape[idx] = dim # <<<<<<<<<<<<<<
  6519. *
  6520. * cdef char order
  6521. */
  6522. (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
  6523. /* "View.MemoryView":151
  6524. *
  6525. *
  6526. * for idx, dim in enumerate(shape): # <<<<<<<<<<<<<<
  6527. * if dim <= 0:
  6528. * raise ValueError("Invalid shape in axis %d: %d." % (idx, dim))
  6529. */
  6530. }
  6531. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6532. /* "View.MemoryView":157
  6533. *
  6534. * cdef char order
  6535. * if mode == 'fortran': # <<<<<<<<<<<<<<
  6536. * order = b'F'
  6537. * self.mode = u'fortran'
  6538. */
  6539. __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 157, __pyx_L1_error)
  6540. if (__pyx_t_4) {
  6541. /* "View.MemoryView":158
  6542. * cdef char order
  6543. * if mode == 'fortran':
  6544. * order = b'F' # <<<<<<<<<<<<<<
  6545. * self.mode = u'fortran'
  6546. * elif mode == 'c':
  6547. */
  6548. __pyx_v_order = 'F';
  6549. /* "View.MemoryView":159
  6550. * if mode == 'fortran':
  6551. * order = b'F'
  6552. * self.mode = u'fortran' # <<<<<<<<<<<<<<
  6553. * elif mode == 'c':
  6554. * order = b'C'
  6555. */
  6556. __Pyx_INCREF(__pyx_n_u_fortran);
  6557. __Pyx_GIVEREF(__pyx_n_u_fortran);
  6558. __Pyx_GOTREF(__pyx_v_self->mode);
  6559. __Pyx_DECREF(__pyx_v_self->mode);
  6560. __pyx_v_self->mode = __pyx_n_u_fortran;
  6561. /* "View.MemoryView":157
  6562. *
  6563. * cdef char order
  6564. * if mode == 'fortran': # <<<<<<<<<<<<<<
  6565. * order = b'F'
  6566. * self.mode = u'fortran'
  6567. */
  6568. goto __pyx_L10;
  6569. }
  6570. /* "View.MemoryView":160
  6571. * order = b'F'
  6572. * self.mode = u'fortran'
  6573. * elif mode == 'c': # <<<<<<<<<<<<<<
  6574. * order = b'C'
  6575. * self.mode = u'c'
  6576. */
  6577. __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 160, __pyx_L1_error)
  6578. if (likely(__pyx_t_4)) {
  6579. /* "View.MemoryView":161
  6580. * self.mode = u'fortran'
  6581. * elif mode == 'c':
  6582. * order = b'C' # <<<<<<<<<<<<<<
  6583. * self.mode = u'c'
  6584. * else:
  6585. */
  6586. __pyx_v_order = 'C';
  6587. /* "View.MemoryView":162
  6588. * elif mode == 'c':
  6589. * order = b'C'
  6590. * self.mode = u'c' # <<<<<<<<<<<<<<
  6591. * else:
  6592. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
  6593. */
  6594. __Pyx_INCREF(__pyx_n_u_c);
  6595. __Pyx_GIVEREF(__pyx_n_u_c);
  6596. __Pyx_GOTREF(__pyx_v_self->mode);
  6597. __Pyx_DECREF(__pyx_v_self->mode);
  6598. __pyx_v_self->mode = __pyx_n_u_c;
  6599. /* "View.MemoryView":160
  6600. * order = b'F'
  6601. * self.mode = u'fortran'
  6602. * elif mode == 'c': # <<<<<<<<<<<<<<
  6603. * order = b'C'
  6604. * self.mode = u'c'
  6605. */
  6606. goto __pyx_L10;
  6607. }
  6608. /* "View.MemoryView":164
  6609. * self.mode = u'c'
  6610. * else:
  6611. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode) # <<<<<<<<<<<<<<
  6612. *
  6613. * self.len = fill_contig_strides_array(self._shape, self._strides,
  6614. */
  6615. /*else*/ {
  6616. __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(2, 164, __pyx_L1_error)
  6617. __Pyx_GOTREF(__pyx_t_3);
  6618. __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 164, __pyx_L1_error)
  6619. __Pyx_GOTREF(__pyx_t_10);
  6620. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6621. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  6622. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  6623. __PYX_ERR(2, 164, __pyx_L1_error)
  6624. }
  6625. __pyx_L10:;
  6626. /* "View.MemoryView":166
  6627. * raise ValueError("Invalid mode, expected 'c' or 'fortran', got %s" % mode)
  6628. *
  6629. * self.len = fill_contig_strides_array(self._shape, self._strides, # <<<<<<<<<<<<<<
  6630. * itemsize, self.ndim, order)
  6631. *
  6632. */
  6633. __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);
  6634. /* "View.MemoryView":169
  6635. * itemsize, self.ndim, order)
  6636. *
  6637. * self.free_data = allocate_buffer # <<<<<<<<<<<<<<
  6638. * self.dtype_is_object = format == b'O'
  6639. * if allocate_buffer:
  6640. */
  6641. __pyx_v_self->free_data = __pyx_v_allocate_buffer;
  6642. /* "View.MemoryView":170
  6643. *
  6644. * self.free_data = allocate_buffer
  6645. * self.dtype_is_object = format == b'O' # <<<<<<<<<<<<<<
  6646. * if allocate_buffer:
  6647. *
  6648. */
  6649. __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(2, 170, __pyx_L1_error)
  6650. __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 170, __pyx_L1_error)
  6651. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  6652. __pyx_v_self->dtype_is_object = __pyx_t_4;
  6653. /* "View.MemoryView":171
  6654. * self.free_data = allocate_buffer
  6655. * self.dtype_is_object = format == b'O'
  6656. * if allocate_buffer: # <<<<<<<<<<<<<<
  6657. *
  6658. *
  6659. */
  6660. __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
  6661. if (__pyx_t_4) {
  6662. /* "View.MemoryView":174
  6663. *
  6664. *
  6665. * self.data = <char *>malloc(self.len) # <<<<<<<<<<<<<<
  6666. * if not self.data:
  6667. * raise MemoryError("unable to allocate array data.")
  6668. */
  6669. __pyx_v_self->data = ((char *)malloc(__pyx_v_self->len));
  6670. /* "View.MemoryView":175
  6671. *
  6672. * self.data = <char *>malloc(self.len)
  6673. * if not self.data: # <<<<<<<<<<<<<<
  6674. * raise MemoryError("unable to allocate array data.")
  6675. *
  6676. */
  6677. __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
  6678. if (unlikely(__pyx_t_4)) {
  6679. /* "View.MemoryView":176
  6680. * self.data = <char *>malloc(self.len)
  6681. * if not self.data:
  6682. * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
  6683. *
  6684. * if self.dtype_is_object:
  6685. */
  6686. __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 176, __pyx_L1_error)
  6687. __Pyx_GOTREF(__pyx_t_10);
  6688. __Pyx_Raise(__pyx_t_10, 0, 0, 0);
  6689. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  6690. __PYX_ERR(2, 176, __pyx_L1_error)
  6691. /* "View.MemoryView":175
  6692. *
  6693. * self.data = <char *>malloc(self.len)
  6694. * if not self.data: # <<<<<<<<<<<<<<
  6695. * raise MemoryError("unable to allocate array data.")
  6696. *
  6697. */
  6698. }
  6699. /* "View.MemoryView":178
  6700. * raise MemoryError("unable to allocate array data.")
  6701. *
  6702. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  6703. * p = <PyObject **> self.data
  6704. * for i in range(self.len / itemsize):
  6705. */
  6706. __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
  6707. if (__pyx_t_4) {
  6708. /* "View.MemoryView":179
  6709. *
  6710. * if self.dtype_is_object:
  6711. * p = <PyObject **> self.data # <<<<<<<<<<<<<<
  6712. * for i in range(self.len / itemsize):
  6713. * p[i] = Py_None
  6714. */
  6715. __pyx_v_p = ((PyObject **)__pyx_v_self->data);
  6716. /* "View.MemoryView":180
  6717. * if self.dtype_is_object:
  6718. * p = <PyObject **> self.data
  6719. * for i in range(self.len / itemsize): # <<<<<<<<<<<<<<
  6720. * p[i] = Py_None
  6721. * Py_INCREF(Py_None)
  6722. */
  6723. if (unlikely(__pyx_v_itemsize == 0)) {
  6724. PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
  6725. __PYX_ERR(2, 180, __pyx_L1_error)
  6726. }
  6727. 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))) {
  6728. PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
  6729. __PYX_ERR(2, 180, __pyx_L1_error)
  6730. }
  6731. __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
  6732. __pyx_t_9 = __pyx_t_1;
  6733. for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
  6734. __pyx_v_i = __pyx_t_11;
  6735. /* "View.MemoryView":181
  6736. * p = <PyObject **> self.data
  6737. * for i in range(self.len / itemsize):
  6738. * p[i] = Py_None # <<<<<<<<<<<<<<
  6739. * Py_INCREF(Py_None)
  6740. *
  6741. */
  6742. (__pyx_v_p[__pyx_v_i]) = Py_None;
  6743. /* "View.MemoryView":182
  6744. * for i in range(self.len / itemsize):
  6745. * p[i] = Py_None
  6746. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  6747. *
  6748. * @cname('getbuffer')
  6749. */
  6750. Py_INCREF(Py_None);
  6751. }
  6752. /* "View.MemoryView":178
  6753. * raise MemoryError("unable to allocate array data.")
  6754. *
  6755. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  6756. * p = <PyObject **> self.data
  6757. * for i in range(self.len / itemsize):
  6758. */
  6759. }
  6760. /* "View.MemoryView":171
  6761. * self.free_data = allocate_buffer
  6762. * self.dtype_is_object = format == b'O'
  6763. * if allocate_buffer: # <<<<<<<<<<<<<<
  6764. *
  6765. *
  6766. */
  6767. }
  6768. /* "View.MemoryView":122
  6769. * cdef bint dtype_is_object
  6770. *
  6771. * def __cinit__(array self, tuple shape, Py_ssize_t itemsize, format not None, # <<<<<<<<<<<<<<
  6772. * mode="c", bint allocate_buffer=True):
  6773. *
  6774. */
  6775. /* function exit code */
  6776. __pyx_r = 0;
  6777. goto __pyx_L0;
  6778. __pyx_L1_error:;
  6779. __Pyx_XDECREF(__pyx_t_3);
  6780. __Pyx_XDECREF(__pyx_t_5);
  6781. __Pyx_XDECREF(__pyx_t_6);
  6782. __Pyx_XDECREF(__pyx_t_10);
  6783. __Pyx_AddTraceback("View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  6784. __pyx_r = -1;
  6785. __pyx_L0:;
  6786. __Pyx_XDECREF(__pyx_v_format);
  6787. __Pyx_RefNannyFinishContext();
  6788. return __pyx_r;
  6789. }
  6790. /* "View.MemoryView":185
  6791. *
  6792. * @cname('getbuffer')
  6793. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  6794. * cdef int bufmode = -1
  6795. * if self.mode == u"c":
  6796. */
  6797. /* Python wrapper */
  6798. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  6799. static CYTHON_UNUSED int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  6800. int __pyx_r;
  6801. __Pyx_RefNannyDeclarations
  6802. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  6803. __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));
  6804. /* function exit code */
  6805. __Pyx_RefNannyFinishContext();
  6806. return __pyx_r;
  6807. }
  6808. 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) {
  6809. int __pyx_v_bufmode;
  6810. int __pyx_r;
  6811. __Pyx_RefNannyDeclarations
  6812. int __pyx_t_1;
  6813. int __pyx_t_2;
  6814. PyObject *__pyx_t_3 = NULL;
  6815. char *__pyx_t_4;
  6816. Py_ssize_t __pyx_t_5;
  6817. int __pyx_t_6;
  6818. Py_ssize_t *__pyx_t_7;
  6819. if (__pyx_v_info == NULL) {
  6820. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  6821. return -1;
  6822. }
  6823. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  6824. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  6825. __Pyx_GIVEREF(__pyx_v_info->obj);
  6826. /* "View.MemoryView":186
  6827. * @cname('getbuffer')
  6828. * def __getbuffer__(self, Py_buffer *info, int flags):
  6829. * cdef int bufmode = -1 # <<<<<<<<<<<<<<
  6830. * if self.mode == u"c":
  6831. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6832. */
  6833. __pyx_v_bufmode = -1;
  6834. /* "View.MemoryView":187
  6835. * def __getbuffer__(self, Py_buffer *info, int flags):
  6836. * cdef int bufmode = -1
  6837. * if self.mode == u"c": # <<<<<<<<<<<<<<
  6838. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6839. * elif self.mode == u"fortran":
  6840. */
  6841. __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 187, __pyx_L1_error)
  6842. __pyx_t_2 = (__pyx_t_1 != 0);
  6843. if (__pyx_t_2) {
  6844. /* "View.MemoryView":188
  6845. * cdef int bufmode = -1
  6846. * if self.mode == u"c":
  6847. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
  6848. * elif self.mode == u"fortran":
  6849. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6850. */
  6851. __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
  6852. /* "View.MemoryView":187
  6853. * def __getbuffer__(self, Py_buffer *info, int flags):
  6854. * cdef int bufmode = -1
  6855. * if self.mode == u"c": # <<<<<<<<<<<<<<
  6856. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6857. * elif self.mode == u"fortran":
  6858. */
  6859. goto __pyx_L3;
  6860. }
  6861. /* "View.MemoryView":189
  6862. * if self.mode == u"c":
  6863. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6864. * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
  6865. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6866. * if not (flags & bufmode):
  6867. */
  6868. __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 189, __pyx_L1_error)
  6869. __pyx_t_1 = (__pyx_t_2 != 0);
  6870. if (__pyx_t_1) {
  6871. /* "View.MemoryView":190
  6872. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6873. * elif self.mode == u"fortran":
  6874. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS # <<<<<<<<<<<<<<
  6875. * if not (flags & bufmode):
  6876. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  6877. */
  6878. __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
  6879. /* "View.MemoryView":189
  6880. * if self.mode == u"c":
  6881. * bufmode = PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6882. * elif self.mode == u"fortran": # <<<<<<<<<<<<<<
  6883. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6884. * if not (flags & bufmode):
  6885. */
  6886. }
  6887. __pyx_L3:;
  6888. /* "View.MemoryView":191
  6889. * elif self.mode == u"fortran":
  6890. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6891. * if not (flags & bufmode): # <<<<<<<<<<<<<<
  6892. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  6893. * info.buf = self.data
  6894. */
  6895. __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
  6896. if (unlikely(__pyx_t_1)) {
  6897. /* "View.MemoryView":192
  6898. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6899. * if not (flags & bufmode):
  6900. * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
  6901. * info.buf = self.data
  6902. * info.len = self.len
  6903. */
  6904. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 192, __pyx_L1_error)
  6905. __Pyx_GOTREF(__pyx_t_3);
  6906. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  6907. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  6908. __PYX_ERR(2, 192, __pyx_L1_error)
  6909. /* "View.MemoryView":191
  6910. * elif self.mode == u"fortran":
  6911. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  6912. * if not (flags & bufmode): # <<<<<<<<<<<<<<
  6913. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  6914. * info.buf = self.data
  6915. */
  6916. }
  6917. /* "View.MemoryView":193
  6918. * if not (flags & bufmode):
  6919. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  6920. * info.buf = self.data # <<<<<<<<<<<<<<
  6921. * info.len = self.len
  6922. * info.ndim = self.ndim
  6923. */
  6924. __pyx_t_4 = __pyx_v_self->data;
  6925. __pyx_v_info->buf = __pyx_t_4;
  6926. /* "View.MemoryView":194
  6927. * raise ValueError("Can only create a buffer that is contiguous in memory.")
  6928. * info.buf = self.data
  6929. * info.len = self.len # <<<<<<<<<<<<<<
  6930. * info.ndim = self.ndim
  6931. * info.shape = self._shape
  6932. */
  6933. __pyx_t_5 = __pyx_v_self->len;
  6934. __pyx_v_info->len = __pyx_t_5;
  6935. /* "View.MemoryView":195
  6936. * info.buf = self.data
  6937. * info.len = self.len
  6938. * info.ndim = self.ndim # <<<<<<<<<<<<<<
  6939. * info.shape = self._shape
  6940. * info.strides = self._strides
  6941. */
  6942. __pyx_t_6 = __pyx_v_self->ndim;
  6943. __pyx_v_info->ndim = __pyx_t_6;
  6944. /* "View.MemoryView":196
  6945. * info.len = self.len
  6946. * info.ndim = self.ndim
  6947. * info.shape = self._shape # <<<<<<<<<<<<<<
  6948. * info.strides = self._strides
  6949. * info.suboffsets = NULL
  6950. */
  6951. __pyx_t_7 = __pyx_v_self->_shape;
  6952. __pyx_v_info->shape = __pyx_t_7;
  6953. /* "View.MemoryView":197
  6954. * info.ndim = self.ndim
  6955. * info.shape = self._shape
  6956. * info.strides = self._strides # <<<<<<<<<<<<<<
  6957. * info.suboffsets = NULL
  6958. * info.itemsize = self.itemsize
  6959. */
  6960. __pyx_t_7 = __pyx_v_self->_strides;
  6961. __pyx_v_info->strides = __pyx_t_7;
  6962. /* "View.MemoryView":198
  6963. * info.shape = self._shape
  6964. * info.strides = self._strides
  6965. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  6966. * info.itemsize = self.itemsize
  6967. * info.readonly = 0
  6968. */
  6969. __pyx_v_info->suboffsets = NULL;
  6970. /* "View.MemoryView":199
  6971. * info.strides = self._strides
  6972. * info.suboffsets = NULL
  6973. * info.itemsize = self.itemsize # <<<<<<<<<<<<<<
  6974. * info.readonly = 0
  6975. *
  6976. */
  6977. __pyx_t_5 = __pyx_v_self->itemsize;
  6978. __pyx_v_info->itemsize = __pyx_t_5;
  6979. /* "View.MemoryView":200
  6980. * info.suboffsets = NULL
  6981. * info.itemsize = self.itemsize
  6982. * info.readonly = 0 # <<<<<<<<<<<<<<
  6983. *
  6984. * if flags & PyBUF_FORMAT:
  6985. */
  6986. __pyx_v_info->readonly = 0;
  6987. /* "View.MemoryView":202
  6988. * info.readonly = 0
  6989. *
  6990. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  6991. * info.format = self.format
  6992. * else:
  6993. */
  6994. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  6995. if (__pyx_t_1) {
  6996. /* "View.MemoryView":203
  6997. *
  6998. * if flags & PyBUF_FORMAT:
  6999. * info.format = self.format # <<<<<<<<<<<<<<
  7000. * else:
  7001. * info.format = NULL
  7002. */
  7003. __pyx_t_4 = __pyx_v_self->format;
  7004. __pyx_v_info->format = __pyx_t_4;
  7005. /* "View.MemoryView":202
  7006. * info.readonly = 0
  7007. *
  7008. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  7009. * info.format = self.format
  7010. * else:
  7011. */
  7012. goto __pyx_L5;
  7013. }
  7014. /* "View.MemoryView":205
  7015. * info.format = self.format
  7016. * else:
  7017. * info.format = NULL # <<<<<<<<<<<<<<
  7018. *
  7019. * info.obj = self
  7020. */
  7021. /*else*/ {
  7022. __pyx_v_info->format = NULL;
  7023. }
  7024. __pyx_L5:;
  7025. /* "View.MemoryView":207
  7026. * info.format = NULL
  7027. *
  7028. * info.obj = self # <<<<<<<<<<<<<<
  7029. *
  7030. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  7031. */
  7032. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  7033. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  7034. __Pyx_GOTREF(__pyx_v_info->obj);
  7035. __Pyx_DECREF(__pyx_v_info->obj);
  7036. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  7037. /* "View.MemoryView":185
  7038. *
  7039. * @cname('getbuffer')
  7040. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  7041. * cdef int bufmode = -1
  7042. * if self.mode == u"c":
  7043. */
  7044. /* function exit code */
  7045. __pyx_r = 0;
  7046. goto __pyx_L0;
  7047. __pyx_L1_error:;
  7048. __Pyx_XDECREF(__pyx_t_3);
  7049. __Pyx_AddTraceback("View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7050. __pyx_r = -1;
  7051. if (__pyx_v_info->obj != NULL) {
  7052. __Pyx_GOTREF(__pyx_v_info->obj);
  7053. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  7054. }
  7055. goto __pyx_L2;
  7056. __pyx_L0:;
  7057. if (__pyx_v_info->obj == Py_None) {
  7058. __Pyx_GOTREF(__pyx_v_info->obj);
  7059. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  7060. }
  7061. __pyx_L2:;
  7062. __Pyx_RefNannyFinishContext();
  7063. return __pyx_r;
  7064. }
  7065. /* "View.MemoryView":211
  7066. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  7067. *
  7068. * def __dealloc__(array self): # <<<<<<<<<<<<<<
  7069. * if self.callback_free_data != NULL:
  7070. * self.callback_free_data(self.data)
  7071. */
  7072. /* Python wrapper */
  7073. static void __pyx_array___dealloc__(PyObject *__pyx_v_self); /*proto*/
  7074. static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
  7075. __Pyx_RefNannyDeclarations
  7076. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  7077. __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((struct __pyx_array_obj *)__pyx_v_self));
  7078. /* function exit code */
  7079. __Pyx_RefNannyFinishContext();
  7080. }
  7081. static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(struct __pyx_array_obj *__pyx_v_self) {
  7082. __Pyx_RefNannyDeclarations
  7083. int __pyx_t_1;
  7084. __Pyx_RefNannySetupContext("__dealloc__", 0);
  7085. /* "View.MemoryView":212
  7086. *
  7087. * def __dealloc__(array self):
  7088. * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
  7089. * self.callback_free_data(self.data)
  7090. * elif self.free_data:
  7091. */
  7092. __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
  7093. if (__pyx_t_1) {
  7094. /* "View.MemoryView":213
  7095. * def __dealloc__(array self):
  7096. * if self.callback_free_data != NULL:
  7097. * self.callback_free_data(self.data) # <<<<<<<<<<<<<<
  7098. * elif self.free_data:
  7099. * if self.dtype_is_object:
  7100. */
  7101. __pyx_v_self->callback_free_data(__pyx_v_self->data);
  7102. /* "View.MemoryView":212
  7103. *
  7104. * def __dealloc__(array self):
  7105. * if self.callback_free_data != NULL: # <<<<<<<<<<<<<<
  7106. * self.callback_free_data(self.data)
  7107. * elif self.free_data:
  7108. */
  7109. goto __pyx_L3;
  7110. }
  7111. /* "View.MemoryView":214
  7112. * if self.callback_free_data != NULL:
  7113. * self.callback_free_data(self.data)
  7114. * elif self.free_data: # <<<<<<<<<<<<<<
  7115. * if self.dtype_is_object:
  7116. * refcount_objects_in_slice(self.data, self._shape,
  7117. */
  7118. __pyx_t_1 = (__pyx_v_self->free_data != 0);
  7119. if (__pyx_t_1) {
  7120. /* "View.MemoryView":215
  7121. * self.callback_free_data(self.data)
  7122. * elif self.free_data:
  7123. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  7124. * refcount_objects_in_slice(self.data, self._shape,
  7125. * self._strides, self.ndim, False)
  7126. */
  7127. __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
  7128. if (__pyx_t_1) {
  7129. /* "View.MemoryView":216
  7130. * elif self.free_data:
  7131. * if self.dtype_is_object:
  7132. * refcount_objects_in_slice(self.data, self._shape, # <<<<<<<<<<<<<<
  7133. * self._strides, self.ndim, False)
  7134. * free(self.data)
  7135. */
  7136. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
  7137. /* "View.MemoryView":215
  7138. * self.callback_free_data(self.data)
  7139. * elif self.free_data:
  7140. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  7141. * refcount_objects_in_slice(self.data, self._shape,
  7142. * self._strides, self.ndim, False)
  7143. */
  7144. }
  7145. /* "View.MemoryView":218
  7146. * refcount_objects_in_slice(self.data, self._shape,
  7147. * self._strides, self.ndim, False)
  7148. * free(self.data) # <<<<<<<<<<<<<<
  7149. * PyObject_Free(self._shape)
  7150. *
  7151. */
  7152. free(__pyx_v_self->data);
  7153. /* "View.MemoryView":214
  7154. * if self.callback_free_data != NULL:
  7155. * self.callback_free_data(self.data)
  7156. * elif self.free_data: # <<<<<<<<<<<<<<
  7157. * if self.dtype_is_object:
  7158. * refcount_objects_in_slice(self.data, self._shape,
  7159. */
  7160. }
  7161. __pyx_L3:;
  7162. /* "View.MemoryView":219
  7163. * self._strides, self.ndim, False)
  7164. * free(self.data)
  7165. * PyObject_Free(self._shape) # <<<<<<<<<<<<<<
  7166. *
  7167. * @property
  7168. */
  7169. PyObject_Free(__pyx_v_self->_shape);
  7170. /* "View.MemoryView":211
  7171. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)")
  7172. *
  7173. * def __dealloc__(array self): # <<<<<<<<<<<<<<
  7174. * if self.callback_free_data != NULL:
  7175. * self.callback_free_data(self.data)
  7176. */
  7177. /* function exit code */
  7178. __Pyx_RefNannyFinishContext();
  7179. }
  7180. /* "View.MemoryView":222
  7181. *
  7182. * @property
  7183. * def memview(self): # <<<<<<<<<<<<<<
  7184. * return self.get_memview()
  7185. *
  7186. */
  7187. /* Python wrapper */
  7188. static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self); /*proto*/
  7189. static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
  7190. PyObject *__pyx_r = 0;
  7191. __Pyx_RefNannyDeclarations
  7192. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  7193. __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((struct __pyx_array_obj *)__pyx_v_self));
  7194. /* function exit code */
  7195. __Pyx_RefNannyFinishContext();
  7196. return __pyx_r;
  7197. }
  7198. static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct __pyx_array_obj *__pyx_v_self) {
  7199. PyObject *__pyx_r = NULL;
  7200. __Pyx_RefNannyDeclarations
  7201. PyObject *__pyx_t_1 = NULL;
  7202. __Pyx_RefNannySetupContext("__get__", 0);
  7203. /* "View.MemoryView":223
  7204. * @property
  7205. * def memview(self):
  7206. * return self.get_memview() # <<<<<<<<<<<<<<
  7207. *
  7208. * @cname('get_memview')
  7209. */
  7210. __Pyx_XDECREF(__pyx_r);
  7211. __pyx_t_1 = ((struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 223, __pyx_L1_error)
  7212. __Pyx_GOTREF(__pyx_t_1);
  7213. __pyx_r = __pyx_t_1;
  7214. __pyx_t_1 = 0;
  7215. goto __pyx_L0;
  7216. /* "View.MemoryView":222
  7217. *
  7218. * @property
  7219. * def memview(self): # <<<<<<<<<<<<<<
  7220. * return self.get_memview()
  7221. *
  7222. */
  7223. /* function exit code */
  7224. __pyx_L1_error:;
  7225. __Pyx_XDECREF(__pyx_t_1);
  7226. __Pyx_AddTraceback("View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7227. __pyx_r = NULL;
  7228. __pyx_L0:;
  7229. __Pyx_XGIVEREF(__pyx_r);
  7230. __Pyx_RefNannyFinishContext();
  7231. return __pyx_r;
  7232. }
  7233. /* "View.MemoryView":226
  7234. *
  7235. * @cname('get_memview')
  7236. * cdef get_memview(self): # <<<<<<<<<<<<<<
  7237. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  7238. * return memoryview(self, flags, self.dtype_is_object)
  7239. */
  7240. static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) {
  7241. int __pyx_v_flags;
  7242. PyObject *__pyx_r = NULL;
  7243. __Pyx_RefNannyDeclarations
  7244. PyObject *__pyx_t_1 = NULL;
  7245. PyObject *__pyx_t_2 = NULL;
  7246. PyObject *__pyx_t_3 = NULL;
  7247. __Pyx_RefNannySetupContext("get_memview", 0);
  7248. /* "View.MemoryView":227
  7249. * @cname('get_memview')
  7250. * cdef get_memview(self):
  7251. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE # <<<<<<<<<<<<<<
  7252. * return memoryview(self, flags, self.dtype_is_object)
  7253. *
  7254. */
  7255. __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
  7256. /* "View.MemoryView":228
  7257. * cdef get_memview(self):
  7258. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  7259. * return memoryview(self, flags, self.dtype_is_object) # <<<<<<<<<<<<<<
  7260. *
  7261. * def __len__(self):
  7262. */
  7263. __Pyx_XDECREF(__pyx_r);
  7264. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 228, __pyx_L1_error)
  7265. __Pyx_GOTREF(__pyx_t_1);
  7266. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
  7267. __Pyx_GOTREF(__pyx_t_2);
  7268. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 228, __pyx_L1_error)
  7269. __Pyx_GOTREF(__pyx_t_3);
  7270. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  7271. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  7272. PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
  7273. __Pyx_GIVEREF(__pyx_t_1);
  7274. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  7275. __Pyx_GIVEREF(__pyx_t_2);
  7276. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  7277. __pyx_t_1 = 0;
  7278. __pyx_t_2 = 0;
  7279. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 228, __pyx_L1_error)
  7280. __Pyx_GOTREF(__pyx_t_2);
  7281. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7282. __pyx_r = __pyx_t_2;
  7283. __pyx_t_2 = 0;
  7284. goto __pyx_L0;
  7285. /* "View.MemoryView":226
  7286. *
  7287. * @cname('get_memview')
  7288. * cdef get_memview(self): # <<<<<<<<<<<<<<
  7289. * flags = PyBUF_ANY_CONTIGUOUS|PyBUF_FORMAT|PyBUF_WRITABLE
  7290. * return memoryview(self, flags, self.dtype_is_object)
  7291. */
  7292. /* function exit code */
  7293. __pyx_L1_error:;
  7294. __Pyx_XDECREF(__pyx_t_1);
  7295. __Pyx_XDECREF(__pyx_t_2);
  7296. __Pyx_XDECREF(__pyx_t_3);
  7297. __Pyx_AddTraceback("View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7298. __pyx_r = 0;
  7299. __pyx_L0:;
  7300. __Pyx_XGIVEREF(__pyx_r);
  7301. __Pyx_RefNannyFinishContext();
  7302. return __pyx_r;
  7303. }
  7304. /* "View.MemoryView":230
  7305. * return memoryview(self, flags, self.dtype_is_object)
  7306. *
  7307. * def __len__(self): # <<<<<<<<<<<<<<
  7308. * return self._shape[0]
  7309. *
  7310. */
  7311. /* Python wrapper */
  7312. static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self); /*proto*/
  7313. static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
  7314. Py_ssize_t __pyx_r;
  7315. __Pyx_RefNannyDeclarations
  7316. __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  7317. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((struct __pyx_array_obj *)__pyx_v_self));
  7318. /* function exit code */
  7319. __Pyx_RefNannyFinishContext();
  7320. return __pyx_r;
  7321. }
  7322. static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(struct __pyx_array_obj *__pyx_v_self) {
  7323. Py_ssize_t __pyx_r;
  7324. __Pyx_RefNannyDeclarations
  7325. __Pyx_RefNannySetupContext("__len__", 0);
  7326. /* "View.MemoryView":231
  7327. *
  7328. * def __len__(self):
  7329. * return self._shape[0] # <<<<<<<<<<<<<<
  7330. *
  7331. * def __getattr__(self, attr):
  7332. */
  7333. __pyx_r = (__pyx_v_self->_shape[0]);
  7334. goto __pyx_L0;
  7335. /* "View.MemoryView":230
  7336. * return memoryview(self, flags, self.dtype_is_object)
  7337. *
  7338. * def __len__(self): # <<<<<<<<<<<<<<
  7339. * return self._shape[0]
  7340. *
  7341. */
  7342. /* function exit code */
  7343. __pyx_L0:;
  7344. __Pyx_RefNannyFinishContext();
  7345. return __pyx_r;
  7346. }
  7347. /* "View.MemoryView":233
  7348. * return self._shape[0]
  7349. *
  7350. * def __getattr__(self, attr): # <<<<<<<<<<<<<<
  7351. * return getattr(self.memview, attr)
  7352. *
  7353. */
  7354. /* Python wrapper */
  7355. static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr); /*proto*/
  7356. static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
  7357. PyObject *__pyx_r = 0;
  7358. __Pyx_RefNannyDeclarations
  7359. __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  7360. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
  7361. /* function exit code */
  7362. __Pyx_RefNannyFinishContext();
  7363. return __pyx_r;
  7364. }
  7365. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
  7366. PyObject *__pyx_r = NULL;
  7367. __Pyx_RefNannyDeclarations
  7368. PyObject *__pyx_t_1 = NULL;
  7369. PyObject *__pyx_t_2 = NULL;
  7370. __Pyx_RefNannySetupContext("__getattr__", 0);
  7371. /* "View.MemoryView":234
  7372. *
  7373. * def __getattr__(self, attr):
  7374. * return getattr(self.memview, attr) # <<<<<<<<<<<<<<
  7375. *
  7376. * def __getitem__(self, item):
  7377. */
  7378. __Pyx_XDECREF(__pyx_r);
  7379. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 234, __pyx_L1_error)
  7380. __Pyx_GOTREF(__pyx_t_1);
  7381. __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 234, __pyx_L1_error)
  7382. __Pyx_GOTREF(__pyx_t_2);
  7383. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7384. __pyx_r = __pyx_t_2;
  7385. __pyx_t_2 = 0;
  7386. goto __pyx_L0;
  7387. /* "View.MemoryView":233
  7388. * return self._shape[0]
  7389. *
  7390. * def __getattr__(self, attr): # <<<<<<<<<<<<<<
  7391. * return getattr(self.memview, attr)
  7392. *
  7393. */
  7394. /* function exit code */
  7395. __pyx_L1_error:;
  7396. __Pyx_XDECREF(__pyx_t_1);
  7397. __Pyx_XDECREF(__pyx_t_2);
  7398. __Pyx_AddTraceback("View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7399. __pyx_r = NULL;
  7400. __pyx_L0:;
  7401. __Pyx_XGIVEREF(__pyx_r);
  7402. __Pyx_RefNannyFinishContext();
  7403. return __pyx_r;
  7404. }
  7405. /* "View.MemoryView":236
  7406. * return getattr(self.memview, attr)
  7407. *
  7408. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  7409. * return self.memview[item]
  7410. *
  7411. */
  7412. /* Python wrapper */
  7413. static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item); /*proto*/
  7414. static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
  7415. PyObject *__pyx_r = 0;
  7416. __Pyx_RefNannyDeclarations
  7417. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  7418. __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
  7419. /* function exit code */
  7420. __Pyx_RefNannyFinishContext();
  7421. return __pyx_r;
  7422. }
  7423. static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
  7424. PyObject *__pyx_r = NULL;
  7425. __Pyx_RefNannyDeclarations
  7426. PyObject *__pyx_t_1 = NULL;
  7427. PyObject *__pyx_t_2 = NULL;
  7428. __Pyx_RefNannySetupContext("__getitem__", 0);
  7429. /* "View.MemoryView":237
  7430. *
  7431. * def __getitem__(self, item):
  7432. * return self.memview[item] # <<<<<<<<<<<<<<
  7433. *
  7434. * def __setitem__(self, item, value):
  7435. */
  7436. __Pyx_XDECREF(__pyx_r);
  7437. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 237, __pyx_L1_error)
  7438. __Pyx_GOTREF(__pyx_t_1);
  7439. __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 237, __pyx_L1_error)
  7440. __Pyx_GOTREF(__pyx_t_2);
  7441. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7442. __pyx_r = __pyx_t_2;
  7443. __pyx_t_2 = 0;
  7444. goto __pyx_L0;
  7445. /* "View.MemoryView":236
  7446. * return getattr(self.memview, attr)
  7447. *
  7448. * def __getitem__(self, item): # <<<<<<<<<<<<<<
  7449. * return self.memview[item]
  7450. *
  7451. */
  7452. /* function exit code */
  7453. __pyx_L1_error:;
  7454. __Pyx_XDECREF(__pyx_t_1);
  7455. __Pyx_XDECREF(__pyx_t_2);
  7456. __Pyx_AddTraceback("View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7457. __pyx_r = NULL;
  7458. __pyx_L0:;
  7459. __Pyx_XGIVEREF(__pyx_r);
  7460. __Pyx_RefNannyFinishContext();
  7461. return __pyx_r;
  7462. }
  7463. /* "View.MemoryView":239
  7464. * return self.memview[item]
  7465. *
  7466. * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
  7467. * self.memview[item] = value
  7468. *
  7469. */
  7470. /* Python wrapper */
  7471. static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value); /*proto*/
  7472. static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
  7473. int __pyx_r;
  7474. __Pyx_RefNannyDeclarations
  7475. __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  7476. __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));
  7477. /* function exit code */
  7478. __Pyx_RefNannyFinishContext();
  7479. return __pyx_r;
  7480. }
  7481. 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) {
  7482. int __pyx_r;
  7483. __Pyx_RefNannyDeclarations
  7484. PyObject *__pyx_t_1 = NULL;
  7485. __Pyx_RefNannySetupContext("__setitem__", 0);
  7486. /* "View.MemoryView":240
  7487. *
  7488. * def __setitem__(self, item, value):
  7489. * self.memview[item] = value # <<<<<<<<<<<<<<
  7490. *
  7491. *
  7492. */
  7493. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 240, __pyx_L1_error)
  7494. __Pyx_GOTREF(__pyx_t_1);
  7495. if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 240, __pyx_L1_error)
  7496. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7497. /* "View.MemoryView":239
  7498. * return self.memview[item]
  7499. *
  7500. * def __setitem__(self, item, value): # <<<<<<<<<<<<<<
  7501. * self.memview[item] = value
  7502. *
  7503. */
  7504. /* function exit code */
  7505. __pyx_r = 0;
  7506. goto __pyx_L0;
  7507. __pyx_L1_error:;
  7508. __Pyx_XDECREF(__pyx_t_1);
  7509. __Pyx_AddTraceback("View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7510. __pyx_r = -1;
  7511. __pyx_L0:;
  7512. __Pyx_RefNannyFinishContext();
  7513. return __pyx_r;
  7514. }
  7515. /* "(tree fragment)":1
  7516. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  7517. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  7518. * def __setstate_cython__(self, __pyx_state):
  7519. */
  7520. /* Python wrapper */
  7521. static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  7522. static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  7523. PyObject *__pyx_r = 0;
  7524. __Pyx_RefNannyDeclarations
  7525. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  7526. __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((struct __pyx_array_obj *)__pyx_v_self));
  7527. /* function exit code */
  7528. __Pyx_RefNannyFinishContext();
  7529. return __pyx_r;
  7530. }
  7531. static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __pyx_array_obj *__pyx_v_self) {
  7532. PyObject *__pyx_r = NULL;
  7533. __Pyx_RefNannyDeclarations
  7534. PyObject *__pyx_t_1 = NULL;
  7535. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  7536. /* "(tree fragment)":2
  7537. * def __reduce_cython__(self):
  7538. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  7539. * def __setstate_cython__(self, __pyx_state):
  7540. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  7541. */
  7542. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  7543. __Pyx_GOTREF(__pyx_t_1);
  7544. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  7545. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7546. __PYX_ERR(2, 2, __pyx_L1_error)
  7547. /* "(tree fragment)":1
  7548. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  7549. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  7550. * def __setstate_cython__(self, __pyx_state):
  7551. */
  7552. /* function exit code */
  7553. __pyx_L1_error:;
  7554. __Pyx_XDECREF(__pyx_t_1);
  7555. __Pyx_AddTraceback("View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7556. __pyx_r = NULL;
  7557. __Pyx_XGIVEREF(__pyx_r);
  7558. __Pyx_RefNannyFinishContext();
  7559. return __pyx_r;
  7560. }
  7561. /* "(tree fragment)":3
  7562. * def __reduce_cython__(self):
  7563. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  7564. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  7565. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  7566. */
  7567. /* Python wrapper */
  7568. static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  7569. static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  7570. PyObject *__pyx_r = 0;
  7571. __Pyx_RefNannyDeclarations
  7572. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  7573. __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  7574. /* function exit code */
  7575. __Pyx_RefNannyFinishContext();
  7576. return __pyx_r;
  7577. }
  7578. 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) {
  7579. PyObject *__pyx_r = NULL;
  7580. __Pyx_RefNannyDeclarations
  7581. PyObject *__pyx_t_1 = NULL;
  7582. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  7583. /* "(tree fragment)":4
  7584. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  7585. * def __setstate_cython__(self, __pyx_state):
  7586. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  7587. */
  7588. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  7589. __Pyx_GOTREF(__pyx_t_1);
  7590. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  7591. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7592. __PYX_ERR(2, 4, __pyx_L1_error)
  7593. /* "(tree fragment)":3
  7594. * def __reduce_cython__(self):
  7595. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  7596. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  7597. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  7598. */
  7599. /* function exit code */
  7600. __pyx_L1_error:;
  7601. __Pyx_XDECREF(__pyx_t_1);
  7602. __Pyx_AddTraceback("View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7603. __pyx_r = NULL;
  7604. __Pyx_XGIVEREF(__pyx_r);
  7605. __Pyx_RefNannyFinishContext();
  7606. return __pyx_r;
  7607. }
  7608. /* "View.MemoryView":244
  7609. *
  7610. * @cname("__pyx_array_new")
  7611. * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
  7612. * char *mode, char *buf):
  7613. * cdef array result
  7614. */
  7615. 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) {
  7616. struct __pyx_array_obj *__pyx_v_result = 0;
  7617. struct __pyx_array_obj *__pyx_r = NULL;
  7618. __Pyx_RefNannyDeclarations
  7619. int __pyx_t_1;
  7620. PyObject *__pyx_t_2 = NULL;
  7621. PyObject *__pyx_t_3 = NULL;
  7622. PyObject *__pyx_t_4 = NULL;
  7623. PyObject *__pyx_t_5 = NULL;
  7624. __Pyx_RefNannySetupContext("array_cwrapper", 0);
  7625. /* "View.MemoryView":248
  7626. * cdef array result
  7627. *
  7628. * if buf == NULL: # <<<<<<<<<<<<<<
  7629. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  7630. * else:
  7631. */
  7632. __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
  7633. if (__pyx_t_1) {
  7634. /* "View.MemoryView":249
  7635. *
  7636. * if buf == NULL:
  7637. * result = array(shape, itemsize, format, mode.decode('ASCII')) # <<<<<<<<<<<<<<
  7638. * else:
  7639. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  7640. */
  7641. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 249, __pyx_L1_error)
  7642. __Pyx_GOTREF(__pyx_t_2);
  7643. __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 249, __pyx_L1_error)
  7644. __Pyx_GOTREF(__pyx_t_3);
  7645. __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(2, 249, __pyx_L1_error)
  7646. __Pyx_GOTREF(__pyx_t_4);
  7647. __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 249, __pyx_L1_error)
  7648. __Pyx_GOTREF(__pyx_t_5);
  7649. __Pyx_INCREF(__pyx_v_shape);
  7650. __Pyx_GIVEREF(__pyx_v_shape);
  7651. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
  7652. __Pyx_GIVEREF(__pyx_t_2);
  7653. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  7654. __Pyx_GIVEREF(__pyx_t_3);
  7655. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  7656. __Pyx_GIVEREF(__pyx_t_4);
  7657. PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  7658. __pyx_t_2 = 0;
  7659. __pyx_t_3 = 0;
  7660. __pyx_t_4 = 0;
  7661. __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 249, __pyx_L1_error)
  7662. __Pyx_GOTREF(__pyx_t_4);
  7663. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  7664. __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_4);
  7665. __pyx_t_4 = 0;
  7666. /* "View.MemoryView":248
  7667. * cdef array result
  7668. *
  7669. * if buf == NULL: # <<<<<<<<<<<<<<
  7670. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  7671. * else:
  7672. */
  7673. goto __pyx_L3;
  7674. }
  7675. /* "View.MemoryView":251
  7676. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  7677. * else:
  7678. * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
  7679. * allocate_buffer=False)
  7680. * result.data = buf
  7681. */
  7682. /*else*/ {
  7683. __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 251, __pyx_L1_error)
  7684. __Pyx_GOTREF(__pyx_t_4);
  7685. __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
  7686. __Pyx_GOTREF(__pyx_t_5);
  7687. __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(2, 251, __pyx_L1_error)
  7688. __Pyx_GOTREF(__pyx_t_3);
  7689. __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 251, __pyx_L1_error)
  7690. __Pyx_GOTREF(__pyx_t_2);
  7691. __Pyx_INCREF(__pyx_v_shape);
  7692. __Pyx_GIVEREF(__pyx_v_shape);
  7693. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
  7694. __Pyx_GIVEREF(__pyx_t_4);
  7695. PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
  7696. __Pyx_GIVEREF(__pyx_t_5);
  7697. PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
  7698. __Pyx_GIVEREF(__pyx_t_3);
  7699. PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
  7700. __pyx_t_4 = 0;
  7701. __pyx_t_5 = 0;
  7702. __pyx_t_3 = 0;
  7703. /* "View.MemoryView":252
  7704. * else:
  7705. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  7706. * allocate_buffer=False) # <<<<<<<<<<<<<<
  7707. * result.data = buf
  7708. *
  7709. */
  7710. __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
  7711. __Pyx_GOTREF(__pyx_t_3);
  7712. if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 252, __pyx_L1_error)
  7713. /* "View.MemoryView":251
  7714. * result = array(shape, itemsize, format, mode.decode('ASCII'))
  7715. * else:
  7716. * result = array(shape, itemsize, format, mode.decode('ASCII'), # <<<<<<<<<<<<<<
  7717. * allocate_buffer=False)
  7718. * result.data = buf
  7719. */
  7720. __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 251, __pyx_L1_error)
  7721. __Pyx_GOTREF(__pyx_t_5);
  7722. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  7723. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  7724. __pyx_v_result = ((struct __pyx_array_obj *)__pyx_t_5);
  7725. __pyx_t_5 = 0;
  7726. /* "View.MemoryView":253
  7727. * result = array(shape, itemsize, format, mode.decode('ASCII'),
  7728. * allocate_buffer=False)
  7729. * result.data = buf # <<<<<<<<<<<<<<
  7730. *
  7731. * return result
  7732. */
  7733. __pyx_v_result->data = __pyx_v_buf;
  7734. }
  7735. __pyx_L3:;
  7736. /* "View.MemoryView":255
  7737. * result.data = buf
  7738. *
  7739. * return result # <<<<<<<<<<<<<<
  7740. *
  7741. *
  7742. */
  7743. __Pyx_XDECREF(((PyObject *)__pyx_r));
  7744. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  7745. __pyx_r = __pyx_v_result;
  7746. goto __pyx_L0;
  7747. /* "View.MemoryView":244
  7748. *
  7749. * @cname("__pyx_array_new")
  7750. * cdef array array_cwrapper(tuple shape, Py_ssize_t itemsize, char *format, # <<<<<<<<<<<<<<
  7751. * char *mode, char *buf):
  7752. * cdef array result
  7753. */
  7754. /* function exit code */
  7755. __pyx_L1_error:;
  7756. __Pyx_XDECREF(__pyx_t_2);
  7757. __Pyx_XDECREF(__pyx_t_3);
  7758. __Pyx_XDECREF(__pyx_t_4);
  7759. __Pyx_XDECREF(__pyx_t_5);
  7760. __Pyx_AddTraceback("View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7761. __pyx_r = 0;
  7762. __pyx_L0:;
  7763. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  7764. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  7765. __Pyx_RefNannyFinishContext();
  7766. return __pyx_r;
  7767. }
  7768. /* "View.MemoryView":281
  7769. * cdef class Enum(object):
  7770. * cdef object name
  7771. * def __init__(self, name): # <<<<<<<<<<<<<<
  7772. * self.name = name
  7773. * def __repr__(self):
  7774. */
  7775. /* Python wrapper */
  7776. static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  7777. static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  7778. PyObject *__pyx_v_name = 0;
  7779. int __pyx_r;
  7780. __Pyx_RefNannyDeclarations
  7781. __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  7782. {
  7783. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
  7784. PyObject* values[1] = {0};
  7785. if (unlikely(__pyx_kwds)) {
  7786. Py_ssize_t kw_args;
  7787. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  7788. switch (pos_args) {
  7789. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  7790. CYTHON_FALLTHROUGH;
  7791. case 0: break;
  7792. default: goto __pyx_L5_argtuple_error;
  7793. }
  7794. kw_args = PyDict_Size(__pyx_kwds);
  7795. switch (pos_args) {
  7796. case 0:
  7797. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
  7798. else goto __pyx_L5_argtuple_error;
  7799. }
  7800. if (unlikely(kw_args > 0)) {
  7801. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(2, 281, __pyx_L3_error)
  7802. }
  7803. } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
  7804. goto __pyx_L5_argtuple_error;
  7805. } else {
  7806. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  7807. }
  7808. __pyx_v_name = values[0];
  7809. }
  7810. goto __pyx_L4_argument_unpacking_done;
  7811. __pyx_L5_argtuple_error:;
  7812. __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 281, __pyx_L3_error)
  7813. __pyx_L3_error:;
  7814. __Pyx_AddTraceback("View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  7815. __Pyx_RefNannyFinishContext();
  7816. return -1;
  7817. __pyx_L4_argument_unpacking_done:;
  7818. __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
  7819. /* function exit code */
  7820. __Pyx_RefNannyFinishContext();
  7821. return __pyx_r;
  7822. }
  7823. static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
  7824. int __pyx_r;
  7825. __Pyx_RefNannyDeclarations
  7826. __Pyx_RefNannySetupContext("__init__", 0);
  7827. /* "View.MemoryView":282
  7828. * cdef object name
  7829. * def __init__(self, name):
  7830. * self.name = name # <<<<<<<<<<<<<<
  7831. * def __repr__(self):
  7832. * return self.name
  7833. */
  7834. __Pyx_INCREF(__pyx_v_name);
  7835. __Pyx_GIVEREF(__pyx_v_name);
  7836. __Pyx_GOTREF(__pyx_v_self->name);
  7837. __Pyx_DECREF(__pyx_v_self->name);
  7838. __pyx_v_self->name = __pyx_v_name;
  7839. /* "View.MemoryView":281
  7840. * cdef class Enum(object):
  7841. * cdef object name
  7842. * def __init__(self, name): # <<<<<<<<<<<<<<
  7843. * self.name = name
  7844. * def __repr__(self):
  7845. */
  7846. /* function exit code */
  7847. __pyx_r = 0;
  7848. __Pyx_RefNannyFinishContext();
  7849. return __pyx_r;
  7850. }
  7851. /* "View.MemoryView":283
  7852. * def __init__(self, name):
  7853. * self.name = name
  7854. * def __repr__(self): # <<<<<<<<<<<<<<
  7855. * return self.name
  7856. *
  7857. */
  7858. /* Python wrapper */
  7859. static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self); /*proto*/
  7860. static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
  7861. PyObject *__pyx_r = 0;
  7862. __Pyx_RefNannyDeclarations
  7863. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  7864. __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
  7865. /* function exit code */
  7866. __Pyx_RefNannyFinishContext();
  7867. return __pyx_r;
  7868. }
  7869. static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  7870. PyObject *__pyx_r = NULL;
  7871. __Pyx_RefNannyDeclarations
  7872. __Pyx_RefNannySetupContext("__repr__", 0);
  7873. /* "View.MemoryView":284
  7874. * self.name = name
  7875. * def __repr__(self):
  7876. * return self.name # <<<<<<<<<<<<<<
  7877. *
  7878. * cdef generic = Enum("<strided and direct or indirect>")
  7879. */
  7880. __Pyx_XDECREF(__pyx_r);
  7881. __Pyx_INCREF(__pyx_v_self->name);
  7882. __pyx_r = __pyx_v_self->name;
  7883. goto __pyx_L0;
  7884. /* "View.MemoryView":283
  7885. * def __init__(self, name):
  7886. * self.name = name
  7887. * def __repr__(self): # <<<<<<<<<<<<<<
  7888. * return self.name
  7889. *
  7890. */
  7891. /* function exit code */
  7892. __pyx_L0:;
  7893. __Pyx_XGIVEREF(__pyx_r);
  7894. __Pyx_RefNannyFinishContext();
  7895. return __pyx_r;
  7896. }
  7897. /* "(tree fragment)":1
  7898. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  7899. * cdef tuple state
  7900. * cdef object _dict
  7901. */
  7902. /* Python wrapper */
  7903. static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  7904. static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  7905. PyObject *__pyx_r = 0;
  7906. __Pyx_RefNannyDeclarations
  7907. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  7908. __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self));
  7909. /* function exit code */
  7910. __Pyx_RefNannyFinishContext();
  7911. return __pyx_r;
  7912. }
  7913. static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self) {
  7914. PyObject *__pyx_v_state = 0;
  7915. PyObject *__pyx_v__dict = 0;
  7916. int __pyx_v_use_setstate;
  7917. PyObject *__pyx_r = NULL;
  7918. __Pyx_RefNannyDeclarations
  7919. PyObject *__pyx_t_1 = NULL;
  7920. int __pyx_t_2;
  7921. int __pyx_t_3;
  7922. PyObject *__pyx_t_4 = NULL;
  7923. PyObject *__pyx_t_5 = NULL;
  7924. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  7925. /* "(tree fragment)":5
  7926. * cdef object _dict
  7927. * cdef bint use_setstate
  7928. * state = (self.name,) # <<<<<<<<<<<<<<
  7929. * _dict = getattr(self, '__dict__', None)
  7930. * if _dict is not None:
  7931. */
  7932. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
  7933. __Pyx_GOTREF(__pyx_t_1);
  7934. __Pyx_INCREF(__pyx_v_self->name);
  7935. __Pyx_GIVEREF(__pyx_v_self->name);
  7936. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
  7937. __pyx_v_state = ((PyObject*)__pyx_t_1);
  7938. __pyx_t_1 = 0;
  7939. /* "(tree fragment)":6
  7940. * cdef bint use_setstate
  7941. * state = (self.name,)
  7942. * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<<
  7943. * if _dict is not None:
  7944. * state += (_dict,)
  7945. */
  7946. __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
  7947. __Pyx_GOTREF(__pyx_t_1);
  7948. __pyx_v__dict = __pyx_t_1;
  7949. __pyx_t_1 = 0;
  7950. /* "(tree fragment)":7
  7951. * state = (self.name,)
  7952. * _dict = getattr(self, '__dict__', None)
  7953. * if _dict is not None: # <<<<<<<<<<<<<<
  7954. * state += (_dict,)
  7955. * use_setstate = True
  7956. */
  7957. __pyx_t_2 = (__pyx_v__dict != Py_None);
  7958. __pyx_t_3 = (__pyx_t_2 != 0);
  7959. if (__pyx_t_3) {
  7960. /* "(tree fragment)":8
  7961. * _dict = getattr(self, '__dict__', None)
  7962. * if _dict is not None:
  7963. * state += (_dict,) # <<<<<<<<<<<<<<
  7964. * use_setstate = True
  7965. * else:
  7966. */
  7967. __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
  7968. __Pyx_GOTREF(__pyx_t_1);
  7969. __Pyx_INCREF(__pyx_v__dict);
  7970. __Pyx_GIVEREF(__pyx_v__dict);
  7971. PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
  7972. __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
  7973. __Pyx_GOTREF(__pyx_t_4);
  7974. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  7975. __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
  7976. __pyx_t_4 = 0;
  7977. /* "(tree fragment)":9
  7978. * if _dict is not None:
  7979. * state += (_dict,)
  7980. * use_setstate = True # <<<<<<<<<<<<<<
  7981. * else:
  7982. * use_setstate = self.name is not None
  7983. */
  7984. __pyx_v_use_setstate = 1;
  7985. /* "(tree fragment)":7
  7986. * state = (self.name,)
  7987. * _dict = getattr(self, '__dict__', None)
  7988. * if _dict is not None: # <<<<<<<<<<<<<<
  7989. * state += (_dict,)
  7990. * use_setstate = True
  7991. */
  7992. goto __pyx_L3;
  7993. }
  7994. /* "(tree fragment)":11
  7995. * use_setstate = True
  7996. * else:
  7997. * use_setstate = self.name is not None # <<<<<<<<<<<<<<
  7998. * if use_setstate:
  7999. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  8000. */
  8001. /*else*/ {
  8002. __pyx_t_3 = (__pyx_v_self->name != Py_None);
  8003. __pyx_v_use_setstate = __pyx_t_3;
  8004. }
  8005. __pyx_L3:;
  8006. /* "(tree fragment)":12
  8007. * else:
  8008. * use_setstate = self.name is not None
  8009. * if use_setstate: # <<<<<<<<<<<<<<
  8010. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  8011. * else:
  8012. */
  8013. __pyx_t_3 = (__pyx_v_use_setstate != 0);
  8014. if (__pyx_t_3) {
  8015. /* "(tree fragment)":13
  8016. * use_setstate = self.name is not None
  8017. * if use_setstate:
  8018. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state # <<<<<<<<<<<<<<
  8019. * else:
  8020. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  8021. */
  8022. __Pyx_XDECREF(__pyx_r);
  8023. __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
  8024. __Pyx_GOTREF(__pyx_t_4);
  8025. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
  8026. __Pyx_GOTREF(__pyx_t_1);
  8027. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8028. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8029. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8030. __Pyx_INCREF(__pyx_int_184977713);
  8031. __Pyx_GIVEREF(__pyx_int_184977713);
  8032. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
  8033. __Pyx_INCREF(Py_None);
  8034. __Pyx_GIVEREF(Py_None);
  8035. PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
  8036. __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
  8037. __Pyx_GOTREF(__pyx_t_5);
  8038. __Pyx_GIVEREF(__pyx_t_4);
  8039. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  8040. __Pyx_GIVEREF(__pyx_t_1);
  8041. PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
  8042. __Pyx_INCREF(__pyx_v_state);
  8043. __Pyx_GIVEREF(__pyx_v_state);
  8044. PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
  8045. __pyx_t_4 = 0;
  8046. __pyx_t_1 = 0;
  8047. __pyx_r = __pyx_t_5;
  8048. __pyx_t_5 = 0;
  8049. goto __pyx_L0;
  8050. /* "(tree fragment)":12
  8051. * else:
  8052. * use_setstate = self.name is not None
  8053. * if use_setstate: # <<<<<<<<<<<<<<
  8054. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  8055. * else:
  8056. */
  8057. }
  8058. /* "(tree fragment)":15
  8059. * return __pyx_unpickle_Enum, (type(self), 0xb068931, None), state
  8060. * else:
  8061. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state) # <<<<<<<<<<<<<<
  8062. * def __setstate_cython__(self, __pyx_state):
  8063. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  8064. */
  8065. /*else*/ {
  8066. __Pyx_XDECREF(__pyx_r);
  8067. __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
  8068. __Pyx_GOTREF(__pyx_t_5);
  8069. __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
  8070. __Pyx_GOTREF(__pyx_t_1);
  8071. __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8072. __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8073. PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
  8074. __Pyx_INCREF(__pyx_int_184977713);
  8075. __Pyx_GIVEREF(__pyx_int_184977713);
  8076. PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
  8077. __Pyx_INCREF(__pyx_v_state);
  8078. __Pyx_GIVEREF(__pyx_v_state);
  8079. PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
  8080. __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
  8081. __Pyx_GOTREF(__pyx_t_4);
  8082. __Pyx_GIVEREF(__pyx_t_5);
  8083. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  8084. __Pyx_GIVEREF(__pyx_t_1);
  8085. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
  8086. __pyx_t_5 = 0;
  8087. __pyx_t_1 = 0;
  8088. __pyx_r = __pyx_t_4;
  8089. __pyx_t_4 = 0;
  8090. goto __pyx_L0;
  8091. }
  8092. /* "(tree fragment)":1
  8093. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  8094. * cdef tuple state
  8095. * cdef object _dict
  8096. */
  8097. /* function exit code */
  8098. __pyx_L1_error:;
  8099. __Pyx_XDECREF(__pyx_t_1);
  8100. __Pyx_XDECREF(__pyx_t_4);
  8101. __Pyx_XDECREF(__pyx_t_5);
  8102. __Pyx_AddTraceback("View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8103. __pyx_r = NULL;
  8104. __pyx_L0:;
  8105. __Pyx_XDECREF(__pyx_v_state);
  8106. __Pyx_XDECREF(__pyx_v__dict);
  8107. __Pyx_XGIVEREF(__pyx_r);
  8108. __Pyx_RefNannyFinishContext();
  8109. return __pyx_r;
  8110. }
  8111. /* "(tree fragment)":16
  8112. * else:
  8113. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  8114. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  8115. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  8116. */
  8117. /* Python wrapper */
  8118. static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  8119. static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  8120. PyObject *__pyx_r = 0;
  8121. __Pyx_RefNannyDeclarations
  8122. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  8123. __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  8124. /* function exit code */
  8125. __Pyx_RefNannyFinishContext();
  8126. return __pyx_r;
  8127. }
  8128. static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  8129. PyObject *__pyx_r = NULL;
  8130. __Pyx_RefNannyDeclarations
  8131. PyObject *__pyx_t_1 = NULL;
  8132. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  8133. /* "(tree fragment)":17
  8134. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  8135. * def __setstate_cython__(self, __pyx_state):
  8136. * __pyx_unpickle_Enum__set_state(self, __pyx_state) # <<<<<<<<<<<<<<
  8137. */
  8138. 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(2, 17, __pyx_L1_error)
  8139. __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
  8140. __Pyx_GOTREF(__pyx_t_1);
  8141. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  8142. /* "(tree fragment)":16
  8143. * else:
  8144. * return __pyx_unpickle_Enum, (type(self), 0xb068931, state)
  8145. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  8146. * __pyx_unpickle_Enum__set_state(self, __pyx_state)
  8147. */
  8148. /* function exit code */
  8149. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  8150. goto __pyx_L0;
  8151. __pyx_L1_error:;
  8152. __Pyx_XDECREF(__pyx_t_1);
  8153. __Pyx_AddTraceback("View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8154. __pyx_r = NULL;
  8155. __pyx_L0:;
  8156. __Pyx_XGIVEREF(__pyx_r);
  8157. __Pyx_RefNannyFinishContext();
  8158. return __pyx_r;
  8159. }
  8160. /* "View.MemoryView":298
  8161. *
  8162. * @cname('__pyx_align_pointer')
  8163. * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
  8164. * "Align pointer memory on a given boundary"
  8165. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
  8166. */
  8167. static void *__pyx_align_pointer(void *__pyx_v_memory, size_t __pyx_v_alignment) {
  8168. Py_intptr_t __pyx_v_aligned_p;
  8169. size_t __pyx_v_offset;
  8170. void *__pyx_r;
  8171. int __pyx_t_1;
  8172. /* "View.MemoryView":300
  8173. * cdef void *align_pointer(void *memory, size_t alignment) nogil:
  8174. * "Align pointer memory on a given boundary"
  8175. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory # <<<<<<<<<<<<<<
  8176. * cdef size_t offset
  8177. *
  8178. */
  8179. __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
  8180. /* "View.MemoryView":304
  8181. *
  8182. * with cython.cdivision(True):
  8183. * offset = aligned_p % alignment # <<<<<<<<<<<<<<
  8184. *
  8185. * if offset > 0:
  8186. */
  8187. __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
  8188. /* "View.MemoryView":306
  8189. * offset = aligned_p % alignment
  8190. *
  8191. * if offset > 0: # <<<<<<<<<<<<<<
  8192. * aligned_p += alignment - offset
  8193. *
  8194. */
  8195. __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
  8196. if (__pyx_t_1) {
  8197. /* "View.MemoryView":307
  8198. *
  8199. * if offset > 0:
  8200. * aligned_p += alignment - offset # <<<<<<<<<<<<<<
  8201. *
  8202. * return <void *> aligned_p
  8203. */
  8204. __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
  8205. /* "View.MemoryView":306
  8206. * offset = aligned_p % alignment
  8207. *
  8208. * if offset > 0: # <<<<<<<<<<<<<<
  8209. * aligned_p += alignment - offset
  8210. *
  8211. */
  8212. }
  8213. /* "View.MemoryView":309
  8214. * aligned_p += alignment - offset
  8215. *
  8216. * return <void *> aligned_p # <<<<<<<<<<<<<<
  8217. *
  8218. *
  8219. */
  8220. __pyx_r = ((void *)__pyx_v_aligned_p);
  8221. goto __pyx_L0;
  8222. /* "View.MemoryView":298
  8223. *
  8224. * @cname('__pyx_align_pointer')
  8225. * cdef void *align_pointer(void *memory, size_t alignment) nogil: # <<<<<<<<<<<<<<
  8226. * "Align pointer memory on a given boundary"
  8227. * cdef Py_intptr_t aligned_p = <Py_intptr_t> memory
  8228. */
  8229. /* function exit code */
  8230. __pyx_L0:;
  8231. return __pyx_r;
  8232. }
  8233. /* "View.MemoryView":345
  8234. * cdef __Pyx_TypeInfo *typeinfo
  8235. *
  8236. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
  8237. * self.obj = obj
  8238. * self.flags = flags
  8239. */
  8240. /* Python wrapper */
  8241. static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  8242. static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  8243. PyObject *__pyx_v_obj = 0;
  8244. int __pyx_v_flags;
  8245. int __pyx_v_dtype_is_object;
  8246. int __pyx_r;
  8247. __Pyx_RefNannyDeclarations
  8248. __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  8249. {
  8250. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
  8251. PyObject* values[3] = {0,0,0};
  8252. if (unlikely(__pyx_kwds)) {
  8253. Py_ssize_t kw_args;
  8254. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  8255. switch (pos_args) {
  8256. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  8257. CYTHON_FALLTHROUGH;
  8258. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  8259. CYTHON_FALLTHROUGH;
  8260. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  8261. CYTHON_FALLTHROUGH;
  8262. case 0: break;
  8263. default: goto __pyx_L5_argtuple_error;
  8264. }
  8265. kw_args = PyDict_Size(__pyx_kwds);
  8266. switch (pos_args) {
  8267. case 0:
  8268. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
  8269. else goto __pyx_L5_argtuple_error;
  8270. CYTHON_FALLTHROUGH;
  8271. case 1:
  8272. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
  8273. else {
  8274. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 345, __pyx_L3_error)
  8275. }
  8276. CYTHON_FALLTHROUGH;
  8277. case 2:
  8278. if (kw_args > 0) {
  8279. PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
  8280. if (value) { values[2] = value; kw_args--; }
  8281. }
  8282. }
  8283. if (unlikely(kw_args > 0)) {
  8284. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(2, 345, __pyx_L3_error)
  8285. }
  8286. } else {
  8287. switch (PyTuple_GET_SIZE(__pyx_args)) {
  8288. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  8289. CYTHON_FALLTHROUGH;
  8290. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  8291. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  8292. break;
  8293. default: goto __pyx_L5_argtuple_error;
  8294. }
  8295. }
  8296. __pyx_v_obj = values[0];
  8297. __pyx_v_flags = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
  8298. if (values[2]) {
  8299. __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_dtype_is_object == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 345, __pyx_L3_error)
  8300. } else {
  8301. __pyx_v_dtype_is_object = ((int)0);
  8302. }
  8303. }
  8304. goto __pyx_L4_argument_unpacking_done;
  8305. __pyx_L5_argtuple_error:;
  8306. __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 345, __pyx_L3_error)
  8307. __pyx_L3_error:;
  8308. __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8309. __Pyx_RefNannyFinishContext();
  8310. return -1;
  8311. __pyx_L4_argument_unpacking_done:;
  8312. __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);
  8313. /* function exit code */
  8314. __Pyx_RefNannyFinishContext();
  8315. return __pyx_r;
  8316. }
  8317. 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) {
  8318. int __pyx_r;
  8319. __Pyx_RefNannyDeclarations
  8320. int __pyx_t_1;
  8321. int __pyx_t_2;
  8322. int __pyx_t_3;
  8323. int __pyx_t_4;
  8324. __Pyx_RefNannySetupContext("__cinit__", 0);
  8325. /* "View.MemoryView":346
  8326. *
  8327. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
  8328. * self.obj = obj # <<<<<<<<<<<<<<
  8329. * self.flags = flags
  8330. * if type(self) is memoryview or obj is not None:
  8331. */
  8332. __Pyx_INCREF(__pyx_v_obj);
  8333. __Pyx_GIVEREF(__pyx_v_obj);
  8334. __Pyx_GOTREF(__pyx_v_self->obj);
  8335. __Pyx_DECREF(__pyx_v_self->obj);
  8336. __pyx_v_self->obj = __pyx_v_obj;
  8337. /* "View.MemoryView":347
  8338. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False):
  8339. * self.obj = obj
  8340. * self.flags = flags # <<<<<<<<<<<<<<
  8341. * if type(self) is memoryview or obj is not None:
  8342. * __Pyx_GetBuffer(obj, &self.view, flags)
  8343. */
  8344. __pyx_v_self->flags = __pyx_v_flags;
  8345. /* "View.MemoryView":348
  8346. * self.obj = obj
  8347. * self.flags = flags
  8348. * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
  8349. * __Pyx_GetBuffer(obj, &self.view, flags)
  8350. * if <PyObject *> self.view.obj == NULL:
  8351. */
  8352. __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
  8353. __pyx_t_3 = (__pyx_t_2 != 0);
  8354. if (!__pyx_t_3) {
  8355. } else {
  8356. __pyx_t_1 = __pyx_t_3;
  8357. goto __pyx_L4_bool_binop_done;
  8358. }
  8359. __pyx_t_3 = (__pyx_v_obj != Py_None);
  8360. __pyx_t_2 = (__pyx_t_3 != 0);
  8361. __pyx_t_1 = __pyx_t_2;
  8362. __pyx_L4_bool_binop_done:;
  8363. if (__pyx_t_1) {
  8364. /* "View.MemoryView":349
  8365. * self.flags = flags
  8366. * if type(self) is memoryview or obj is not None:
  8367. * __Pyx_GetBuffer(obj, &self.view, flags) # <<<<<<<<<<<<<<
  8368. * if <PyObject *> self.view.obj == NULL:
  8369. * (<__pyx_buffer *> &self.view).obj = Py_None
  8370. */
  8371. __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 349, __pyx_L1_error)
  8372. /* "View.MemoryView":350
  8373. * if type(self) is memoryview or obj is not None:
  8374. * __Pyx_GetBuffer(obj, &self.view, flags)
  8375. * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
  8376. * (<__pyx_buffer *> &self.view).obj = Py_None
  8377. * Py_INCREF(Py_None)
  8378. */
  8379. __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
  8380. if (__pyx_t_1) {
  8381. /* "View.MemoryView":351
  8382. * __Pyx_GetBuffer(obj, &self.view, flags)
  8383. * if <PyObject *> self.view.obj == NULL:
  8384. * (<__pyx_buffer *> &self.view).obj = Py_None # <<<<<<<<<<<<<<
  8385. * Py_INCREF(Py_None)
  8386. *
  8387. */
  8388. ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
  8389. /* "View.MemoryView":352
  8390. * if <PyObject *> self.view.obj == NULL:
  8391. * (<__pyx_buffer *> &self.view).obj = Py_None
  8392. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  8393. *
  8394. * global __pyx_memoryview_thread_locks_used
  8395. */
  8396. Py_INCREF(Py_None);
  8397. /* "View.MemoryView":350
  8398. * if type(self) is memoryview or obj is not None:
  8399. * __Pyx_GetBuffer(obj, &self.view, flags)
  8400. * if <PyObject *> self.view.obj == NULL: # <<<<<<<<<<<<<<
  8401. * (<__pyx_buffer *> &self.view).obj = Py_None
  8402. * Py_INCREF(Py_None)
  8403. */
  8404. }
  8405. /* "View.MemoryView":348
  8406. * self.obj = obj
  8407. * self.flags = flags
  8408. * if type(self) is memoryview or obj is not None: # <<<<<<<<<<<<<<
  8409. * __Pyx_GetBuffer(obj, &self.view, flags)
  8410. * if <PyObject *> self.view.obj == NULL:
  8411. */
  8412. }
  8413. /* "View.MemoryView":355
  8414. *
  8415. * global __pyx_memoryview_thread_locks_used
  8416. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
  8417. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  8418. * __pyx_memoryview_thread_locks_used += 1
  8419. */
  8420. __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
  8421. if (__pyx_t_1) {
  8422. /* "View.MemoryView":356
  8423. * global __pyx_memoryview_thread_locks_used
  8424. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
  8425. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] # <<<<<<<<<<<<<<
  8426. * __pyx_memoryview_thread_locks_used += 1
  8427. * if self.lock is NULL:
  8428. */
  8429. __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
  8430. /* "View.MemoryView":357
  8431. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED:
  8432. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  8433. * __pyx_memoryview_thread_locks_used += 1 # <<<<<<<<<<<<<<
  8434. * if self.lock is NULL:
  8435. * self.lock = PyThread_allocate_lock()
  8436. */
  8437. __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
  8438. /* "View.MemoryView":355
  8439. *
  8440. * global __pyx_memoryview_thread_locks_used
  8441. * if __pyx_memoryview_thread_locks_used < THREAD_LOCKS_PREALLOCATED: # <<<<<<<<<<<<<<
  8442. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  8443. * __pyx_memoryview_thread_locks_used += 1
  8444. */
  8445. }
  8446. /* "View.MemoryView":358
  8447. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  8448. * __pyx_memoryview_thread_locks_used += 1
  8449. * if self.lock is NULL: # <<<<<<<<<<<<<<
  8450. * self.lock = PyThread_allocate_lock()
  8451. * if self.lock is NULL:
  8452. */
  8453. __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  8454. if (__pyx_t_1) {
  8455. /* "View.MemoryView":359
  8456. * __pyx_memoryview_thread_locks_used += 1
  8457. * if self.lock is NULL:
  8458. * self.lock = PyThread_allocate_lock() # <<<<<<<<<<<<<<
  8459. * if self.lock is NULL:
  8460. * raise MemoryError
  8461. */
  8462. __pyx_v_self->lock = PyThread_allocate_lock();
  8463. /* "View.MemoryView":360
  8464. * if self.lock is NULL:
  8465. * self.lock = PyThread_allocate_lock()
  8466. * if self.lock is NULL: # <<<<<<<<<<<<<<
  8467. * raise MemoryError
  8468. *
  8469. */
  8470. __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
  8471. if (unlikely(__pyx_t_1)) {
  8472. /* "View.MemoryView":361
  8473. * self.lock = PyThread_allocate_lock()
  8474. * if self.lock is NULL:
  8475. * raise MemoryError # <<<<<<<<<<<<<<
  8476. *
  8477. * if flags & PyBUF_FORMAT:
  8478. */
  8479. PyErr_NoMemory(); __PYX_ERR(2, 361, __pyx_L1_error)
  8480. /* "View.MemoryView":360
  8481. * if self.lock is NULL:
  8482. * self.lock = PyThread_allocate_lock()
  8483. * if self.lock is NULL: # <<<<<<<<<<<<<<
  8484. * raise MemoryError
  8485. *
  8486. */
  8487. }
  8488. /* "View.MemoryView":358
  8489. * self.lock = __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]
  8490. * __pyx_memoryview_thread_locks_used += 1
  8491. * if self.lock is NULL: # <<<<<<<<<<<<<<
  8492. * self.lock = PyThread_allocate_lock()
  8493. * if self.lock is NULL:
  8494. */
  8495. }
  8496. /* "View.MemoryView":363
  8497. * raise MemoryError
  8498. *
  8499. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  8500. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  8501. * else:
  8502. */
  8503. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  8504. if (__pyx_t_1) {
  8505. /* "View.MemoryView":364
  8506. *
  8507. * if flags & PyBUF_FORMAT:
  8508. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0') # <<<<<<<<<<<<<<
  8509. * else:
  8510. * self.dtype_is_object = dtype_is_object
  8511. */
  8512. __pyx_t_2 = (((__pyx_v_self->view.format[0]) == 'O') != 0);
  8513. if (__pyx_t_2) {
  8514. } else {
  8515. __pyx_t_1 = __pyx_t_2;
  8516. goto __pyx_L11_bool_binop_done;
  8517. }
  8518. __pyx_t_2 = (((__pyx_v_self->view.format[1]) == '\x00') != 0);
  8519. __pyx_t_1 = __pyx_t_2;
  8520. __pyx_L11_bool_binop_done:;
  8521. __pyx_v_self->dtype_is_object = __pyx_t_1;
  8522. /* "View.MemoryView":363
  8523. * raise MemoryError
  8524. *
  8525. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  8526. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  8527. * else:
  8528. */
  8529. goto __pyx_L10;
  8530. }
  8531. /* "View.MemoryView":366
  8532. * self.dtype_is_object = (self.view.format[0] == b'O' and self.view.format[1] == b'\0')
  8533. * else:
  8534. * self.dtype_is_object = dtype_is_object # <<<<<<<<<<<<<<
  8535. *
  8536. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
  8537. */
  8538. /*else*/ {
  8539. __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
  8540. }
  8541. __pyx_L10:;
  8542. /* "View.MemoryView":368
  8543. * self.dtype_is_object = dtype_is_object
  8544. *
  8545. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer( # <<<<<<<<<<<<<<
  8546. * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
  8547. * self.typeinfo = NULL
  8548. */
  8549. __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((void *)(&(__pyx_v_self->acquisition_count[0]))), (sizeof(__pyx_atomic_int))));
  8550. /* "View.MemoryView":370
  8551. * self.acquisition_count_aligned_p = <__pyx_atomic_int *> align_pointer(
  8552. * <void *> &self.acquisition_count[0], sizeof(__pyx_atomic_int))
  8553. * self.typeinfo = NULL # <<<<<<<<<<<<<<
  8554. *
  8555. * def __dealloc__(memoryview self):
  8556. */
  8557. __pyx_v_self->typeinfo = NULL;
  8558. /* "View.MemoryView":345
  8559. * cdef __Pyx_TypeInfo *typeinfo
  8560. *
  8561. * def __cinit__(memoryview self, object obj, int flags, bint dtype_is_object=False): # <<<<<<<<<<<<<<
  8562. * self.obj = obj
  8563. * self.flags = flags
  8564. */
  8565. /* function exit code */
  8566. __pyx_r = 0;
  8567. goto __pyx_L0;
  8568. __pyx_L1_error:;
  8569. __Pyx_AddTraceback("View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8570. __pyx_r = -1;
  8571. __pyx_L0:;
  8572. __Pyx_RefNannyFinishContext();
  8573. return __pyx_r;
  8574. }
  8575. /* "View.MemoryView":372
  8576. * self.typeinfo = NULL
  8577. *
  8578. * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
  8579. * if self.obj is not None:
  8580. * __Pyx_ReleaseBuffer(&self.view)
  8581. */
  8582. /* Python wrapper */
  8583. static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self); /*proto*/
  8584. static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
  8585. __Pyx_RefNannyDeclarations
  8586. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  8587. __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  8588. /* function exit code */
  8589. __Pyx_RefNannyFinishContext();
  8590. }
  8591. static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(struct __pyx_memoryview_obj *__pyx_v_self) {
  8592. int __pyx_v_i;
  8593. __Pyx_RefNannyDeclarations
  8594. int __pyx_t_1;
  8595. int __pyx_t_2;
  8596. int __pyx_t_3;
  8597. int __pyx_t_4;
  8598. int __pyx_t_5;
  8599. PyThread_type_lock __pyx_t_6;
  8600. PyThread_type_lock __pyx_t_7;
  8601. __Pyx_RefNannySetupContext("__dealloc__", 0);
  8602. /* "View.MemoryView":373
  8603. *
  8604. * def __dealloc__(memoryview self):
  8605. * if self.obj is not None: # <<<<<<<<<<<<<<
  8606. * __Pyx_ReleaseBuffer(&self.view)
  8607. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  8608. */
  8609. __pyx_t_1 = (__pyx_v_self->obj != Py_None);
  8610. __pyx_t_2 = (__pyx_t_1 != 0);
  8611. if (__pyx_t_2) {
  8612. /* "View.MemoryView":374
  8613. * def __dealloc__(memoryview self):
  8614. * if self.obj is not None:
  8615. * __Pyx_ReleaseBuffer(&self.view) # <<<<<<<<<<<<<<
  8616. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  8617. *
  8618. */
  8619. __Pyx_ReleaseBuffer((&__pyx_v_self->view));
  8620. /* "View.MemoryView":373
  8621. *
  8622. * def __dealloc__(memoryview self):
  8623. * if self.obj is not None: # <<<<<<<<<<<<<<
  8624. * __Pyx_ReleaseBuffer(&self.view)
  8625. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  8626. */
  8627. goto __pyx_L3;
  8628. }
  8629. /* "View.MemoryView":375
  8630. * if self.obj is not None:
  8631. * __Pyx_ReleaseBuffer(&self.view)
  8632. * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
  8633. *
  8634. * (<__pyx_buffer *> &self.view).obj = NULL
  8635. */
  8636. __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
  8637. if (__pyx_t_2) {
  8638. /* "View.MemoryView":377
  8639. * elif (<__pyx_buffer *> &self.view).obj == Py_None:
  8640. *
  8641. * (<__pyx_buffer *> &self.view).obj = NULL # <<<<<<<<<<<<<<
  8642. * Py_DECREF(Py_None)
  8643. *
  8644. */
  8645. ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
  8646. /* "View.MemoryView":378
  8647. *
  8648. * (<__pyx_buffer *> &self.view).obj = NULL
  8649. * Py_DECREF(Py_None) # <<<<<<<<<<<<<<
  8650. *
  8651. * cdef int i
  8652. */
  8653. Py_DECREF(Py_None);
  8654. /* "View.MemoryView":375
  8655. * if self.obj is not None:
  8656. * __Pyx_ReleaseBuffer(&self.view)
  8657. * elif (<__pyx_buffer *> &self.view).obj == Py_None: # <<<<<<<<<<<<<<
  8658. *
  8659. * (<__pyx_buffer *> &self.view).obj = NULL
  8660. */
  8661. }
  8662. __pyx_L3:;
  8663. /* "View.MemoryView":382
  8664. * cdef int i
  8665. * global __pyx_memoryview_thread_locks_used
  8666. * if self.lock != NULL: # <<<<<<<<<<<<<<
  8667. * for i in range(__pyx_memoryview_thread_locks_used):
  8668. * if __pyx_memoryview_thread_locks[i] is self.lock:
  8669. */
  8670. __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
  8671. if (__pyx_t_2) {
  8672. /* "View.MemoryView":383
  8673. * global __pyx_memoryview_thread_locks_used
  8674. * if self.lock != NULL:
  8675. * for i in range(__pyx_memoryview_thread_locks_used): # <<<<<<<<<<<<<<
  8676. * if __pyx_memoryview_thread_locks[i] is self.lock:
  8677. * __pyx_memoryview_thread_locks_used -= 1
  8678. */
  8679. __pyx_t_3 = __pyx_memoryview_thread_locks_used;
  8680. __pyx_t_4 = __pyx_t_3;
  8681. for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
  8682. __pyx_v_i = __pyx_t_5;
  8683. /* "View.MemoryView":384
  8684. * if self.lock != NULL:
  8685. * for i in range(__pyx_memoryview_thread_locks_used):
  8686. * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
  8687. * __pyx_memoryview_thread_locks_used -= 1
  8688. * if i != __pyx_memoryview_thread_locks_used:
  8689. */
  8690. __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
  8691. if (__pyx_t_2) {
  8692. /* "View.MemoryView":385
  8693. * for i in range(__pyx_memoryview_thread_locks_used):
  8694. * if __pyx_memoryview_thread_locks[i] is self.lock:
  8695. * __pyx_memoryview_thread_locks_used -= 1 # <<<<<<<<<<<<<<
  8696. * if i != __pyx_memoryview_thread_locks_used:
  8697. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  8698. */
  8699. __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
  8700. /* "View.MemoryView":386
  8701. * if __pyx_memoryview_thread_locks[i] is self.lock:
  8702. * __pyx_memoryview_thread_locks_used -= 1
  8703. * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
  8704. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  8705. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  8706. */
  8707. __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
  8708. if (__pyx_t_2) {
  8709. /* "View.MemoryView":388
  8710. * if i != __pyx_memoryview_thread_locks_used:
  8711. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  8712. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i]) # <<<<<<<<<<<<<<
  8713. * break
  8714. * else:
  8715. */
  8716. __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
  8717. __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
  8718. /* "View.MemoryView":387
  8719. * __pyx_memoryview_thread_locks_used -= 1
  8720. * if i != __pyx_memoryview_thread_locks_used:
  8721. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = ( # <<<<<<<<<<<<<<
  8722. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  8723. * break
  8724. */
  8725. (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
  8726. (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
  8727. /* "View.MemoryView":386
  8728. * if __pyx_memoryview_thread_locks[i] is self.lock:
  8729. * __pyx_memoryview_thread_locks_used -= 1
  8730. * if i != __pyx_memoryview_thread_locks_used: # <<<<<<<<<<<<<<
  8731. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  8732. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  8733. */
  8734. }
  8735. /* "View.MemoryView":389
  8736. * __pyx_memoryview_thread_locks[i], __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used] = (
  8737. * __pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used], __pyx_memoryview_thread_locks[i])
  8738. * break # <<<<<<<<<<<<<<
  8739. * else:
  8740. * PyThread_free_lock(self.lock)
  8741. */
  8742. goto __pyx_L6_break;
  8743. /* "View.MemoryView":384
  8744. * if self.lock != NULL:
  8745. * for i in range(__pyx_memoryview_thread_locks_used):
  8746. * if __pyx_memoryview_thread_locks[i] is self.lock: # <<<<<<<<<<<<<<
  8747. * __pyx_memoryview_thread_locks_used -= 1
  8748. * if i != __pyx_memoryview_thread_locks_used:
  8749. */
  8750. }
  8751. }
  8752. /*else*/ {
  8753. /* "View.MemoryView":391
  8754. * break
  8755. * else:
  8756. * PyThread_free_lock(self.lock) # <<<<<<<<<<<<<<
  8757. *
  8758. * cdef char *get_item_pointer(memoryview self, object index) except NULL:
  8759. */
  8760. PyThread_free_lock(__pyx_v_self->lock);
  8761. }
  8762. __pyx_L6_break:;
  8763. /* "View.MemoryView":382
  8764. * cdef int i
  8765. * global __pyx_memoryview_thread_locks_used
  8766. * if self.lock != NULL: # <<<<<<<<<<<<<<
  8767. * for i in range(__pyx_memoryview_thread_locks_used):
  8768. * if __pyx_memoryview_thread_locks[i] is self.lock:
  8769. */
  8770. }
  8771. /* "View.MemoryView":372
  8772. * self.typeinfo = NULL
  8773. *
  8774. * def __dealloc__(memoryview self): # <<<<<<<<<<<<<<
  8775. * if self.obj is not None:
  8776. * __Pyx_ReleaseBuffer(&self.view)
  8777. */
  8778. /* function exit code */
  8779. __Pyx_RefNannyFinishContext();
  8780. }
  8781. /* "View.MemoryView":393
  8782. * PyThread_free_lock(self.lock)
  8783. *
  8784. * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
  8785. * cdef Py_ssize_t dim
  8786. * cdef char *itemp = <char *> self.view.buf
  8787. */
  8788. static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  8789. Py_ssize_t __pyx_v_dim;
  8790. char *__pyx_v_itemp;
  8791. PyObject *__pyx_v_idx = NULL;
  8792. char *__pyx_r;
  8793. __Pyx_RefNannyDeclarations
  8794. Py_ssize_t __pyx_t_1;
  8795. PyObject *__pyx_t_2 = NULL;
  8796. Py_ssize_t __pyx_t_3;
  8797. PyObject *(*__pyx_t_4)(PyObject *);
  8798. PyObject *__pyx_t_5 = NULL;
  8799. Py_ssize_t __pyx_t_6;
  8800. char *__pyx_t_7;
  8801. __Pyx_RefNannySetupContext("get_item_pointer", 0);
  8802. /* "View.MemoryView":395
  8803. * cdef char *get_item_pointer(memoryview self, object index) except NULL:
  8804. * cdef Py_ssize_t dim
  8805. * cdef char *itemp = <char *> self.view.buf # <<<<<<<<<<<<<<
  8806. *
  8807. * for dim, idx in enumerate(index):
  8808. */
  8809. __pyx_v_itemp = ((char *)__pyx_v_self->view.buf);
  8810. /* "View.MemoryView":397
  8811. * cdef char *itemp = <char *> self.view.buf
  8812. *
  8813. * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
  8814. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  8815. *
  8816. */
  8817. __pyx_t_1 = 0;
  8818. if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
  8819. __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
  8820. __pyx_t_4 = NULL;
  8821. } else {
  8822. __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 397, __pyx_L1_error)
  8823. __Pyx_GOTREF(__pyx_t_2);
  8824. __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 397, __pyx_L1_error)
  8825. }
  8826. for (;;) {
  8827. if (likely(!__pyx_t_4)) {
  8828. if (likely(PyList_CheckExact(__pyx_t_2))) {
  8829. if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
  8830. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8831. __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(2, 397, __pyx_L1_error)
  8832. #else
  8833. __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
  8834. __Pyx_GOTREF(__pyx_t_5);
  8835. #endif
  8836. } else {
  8837. if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
  8838. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8839. __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(2, 397, __pyx_L1_error)
  8840. #else
  8841. __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 397, __pyx_L1_error)
  8842. __Pyx_GOTREF(__pyx_t_5);
  8843. #endif
  8844. }
  8845. } else {
  8846. __pyx_t_5 = __pyx_t_4(__pyx_t_2);
  8847. if (unlikely(!__pyx_t_5)) {
  8848. PyObject* exc_type = PyErr_Occurred();
  8849. if (exc_type) {
  8850. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  8851. else __PYX_ERR(2, 397, __pyx_L1_error)
  8852. }
  8853. break;
  8854. }
  8855. __Pyx_GOTREF(__pyx_t_5);
  8856. }
  8857. __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
  8858. __pyx_t_5 = 0;
  8859. __pyx_v_dim = __pyx_t_1;
  8860. __pyx_t_1 = (__pyx_t_1 + 1);
  8861. /* "View.MemoryView":398
  8862. *
  8863. * for dim, idx in enumerate(index):
  8864. * itemp = pybuffer_index(&self.view, itemp, idx, dim) # <<<<<<<<<<<<<<
  8865. *
  8866. * return itemp
  8867. */
  8868. __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 398, __pyx_L1_error)
  8869. __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(2, 398, __pyx_L1_error)
  8870. __pyx_v_itemp = __pyx_t_7;
  8871. /* "View.MemoryView":397
  8872. * cdef char *itemp = <char *> self.view.buf
  8873. *
  8874. * for dim, idx in enumerate(index): # <<<<<<<<<<<<<<
  8875. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  8876. *
  8877. */
  8878. }
  8879. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  8880. /* "View.MemoryView":400
  8881. * itemp = pybuffer_index(&self.view, itemp, idx, dim)
  8882. *
  8883. * return itemp # <<<<<<<<<<<<<<
  8884. *
  8885. *
  8886. */
  8887. __pyx_r = __pyx_v_itemp;
  8888. goto __pyx_L0;
  8889. /* "View.MemoryView":393
  8890. * PyThread_free_lock(self.lock)
  8891. *
  8892. * cdef char *get_item_pointer(memoryview self, object index) except NULL: # <<<<<<<<<<<<<<
  8893. * cdef Py_ssize_t dim
  8894. * cdef char *itemp = <char *> self.view.buf
  8895. */
  8896. /* function exit code */
  8897. __pyx_L1_error:;
  8898. __Pyx_XDECREF(__pyx_t_2);
  8899. __Pyx_XDECREF(__pyx_t_5);
  8900. __Pyx_AddTraceback("View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  8901. __pyx_r = NULL;
  8902. __pyx_L0:;
  8903. __Pyx_XDECREF(__pyx_v_idx);
  8904. __Pyx_RefNannyFinishContext();
  8905. return __pyx_r;
  8906. }
  8907. /* "View.MemoryView":403
  8908. *
  8909. *
  8910. * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
  8911. * if index is Ellipsis:
  8912. * return self
  8913. */
  8914. /* Python wrapper */
  8915. static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index); /*proto*/
  8916. static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
  8917. PyObject *__pyx_r = 0;
  8918. __Pyx_RefNannyDeclarations
  8919. __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0);
  8920. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
  8921. /* function exit code */
  8922. __Pyx_RefNannyFinishContext();
  8923. return __pyx_r;
  8924. }
  8925. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
  8926. PyObject *__pyx_v_have_slices = NULL;
  8927. PyObject *__pyx_v_indices = NULL;
  8928. char *__pyx_v_itemp;
  8929. PyObject *__pyx_r = NULL;
  8930. __Pyx_RefNannyDeclarations
  8931. int __pyx_t_1;
  8932. int __pyx_t_2;
  8933. PyObject *__pyx_t_3 = NULL;
  8934. PyObject *__pyx_t_4 = NULL;
  8935. PyObject *__pyx_t_5 = NULL;
  8936. char *__pyx_t_6;
  8937. __Pyx_RefNannySetupContext("__getitem__", 0);
  8938. /* "View.MemoryView":404
  8939. *
  8940. * def __getitem__(memoryview self, object index):
  8941. * if index is Ellipsis: # <<<<<<<<<<<<<<
  8942. * return self
  8943. *
  8944. */
  8945. __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
  8946. __pyx_t_2 = (__pyx_t_1 != 0);
  8947. if (__pyx_t_2) {
  8948. /* "View.MemoryView":405
  8949. * def __getitem__(memoryview self, object index):
  8950. * if index is Ellipsis:
  8951. * return self # <<<<<<<<<<<<<<
  8952. *
  8953. * have_slices, indices = _unellipsify(index, self.view.ndim)
  8954. */
  8955. __Pyx_XDECREF(__pyx_r);
  8956. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  8957. __pyx_r = ((PyObject *)__pyx_v_self);
  8958. goto __pyx_L0;
  8959. /* "View.MemoryView":404
  8960. *
  8961. * def __getitem__(memoryview self, object index):
  8962. * if index is Ellipsis: # <<<<<<<<<<<<<<
  8963. * return self
  8964. *
  8965. */
  8966. }
  8967. /* "View.MemoryView":407
  8968. * return self
  8969. *
  8970. * have_slices, indices = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
  8971. *
  8972. * cdef char *itemp
  8973. */
  8974. __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 407, __pyx_L1_error)
  8975. __Pyx_GOTREF(__pyx_t_3);
  8976. if (likely(__pyx_t_3 != Py_None)) {
  8977. PyObject* sequence = __pyx_t_3;
  8978. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  8979. if (unlikely(size != 2)) {
  8980. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  8981. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  8982. __PYX_ERR(2, 407, __pyx_L1_error)
  8983. }
  8984. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  8985. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
  8986. __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
  8987. __Pyx_INCREF(__pyx_t_4);
  8988. __Pyx_INCREF(__pyx_t_5);
  8989. #else
  8990. __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 407, __pyx_L1_error)
  8991. __Pyx_GOTREF(__pyx_t_4);
  8992. __pyx_t_5 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 407, __pyx_L1_error)
  8993. __Pyx_GOTREF(__pyx_t_5);
  8994. #endif
  8995. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  8996. } else {
  8997. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 407, __pyx_L1_error)
  8998. }
  8999. __pyx_v_have_slices = __pyx_t_4;
  9000. __pyx_t_4 = 0;
  9001. __pyx_v_indices = __pyx_t_5;
  9002. __pyx_t_5 = 0;
  9003. /* "View.MemoryView":410
  9004. *
  9005. * cdef char *itemp
  9006. * if have_slices: # <<<<<<<<<<<<<<
  9007. * return memview_slice(self, indices)
  9008. * else:
  9009. */
  9010. __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 410, __pyx_L1_error)
  9011. if (__pyx_t_2) {
  9012. /* "View.MemoryView":411
  9013. * cdef char *itemp
  9014. * if have_slices:
  9015. * return memview_slice(self, indices) # <<<<<<<<<<<<<<
  9016. * else:
  9017. * itemp = self.get_item_pointer(indices)
  9018. */
  9019. __Pyx_XDECREF(__pyx_r);
  9020. __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 411, __pyx_L1_error)
  9021. __Pyx_GOTREF(__pyx_t_3);
  9022. __pyx_r = __pyx_t_3;
  9023. __pyx_t_3 = 0;
  9024. goto __pyx_L0;
  9025. /* "View.MemoryView":410
  9026. *
  9027. * cdef char *itemp
  9028. * if have_slices: # <<<<<<<<<<<<<<
  9029. * return memview_slice(self, indices)
  9030. * else:
  9031. */
  9032. }
  9033. /* "View.MemoryView":413
  9034. * return memview_slice(self, indices)
  9035. * else:
  9036. * itemp = self.get_item_pointer(indices) # <<<<<<<<<<<<<<
  9037. * return self.convert_item_to_object(itemp)
  9038. *
  9039. */
  9040. /*else*/ {
  9041. __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(2, 413, __pyx_L1_error)
  9042. __pyx_v_itemp = __pyx_t_6;
  9043. /* "View.MemoryView":414
  9044. * else:
  9045. * itemp = self.get_item_pointer(indices)
  9046. * return self.convert_item_to_object(itemp) # <<<<<<<<<<<<<<
  9047. *
  9048. * def __setitem__(memoryview self, object index, object value):
  9049. */
  9050. __Pyx_XDECREF(__pyx_r);
  9051. __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(2, 414, __pyx_L1_error)
  9052. __Pyx_GOTREF(__pyx_t_3);
  9053. __pyx_r = __pyx_t_3;
  9054. __pyx_t_3 = 0;
  9055. goto __pyx_L0;
  9056. }
  9057. /* "View.MemoryView":403
  9058. *
  9059. *
  9060. * def __getitem__(memoryview self, object index): # <<<<<<<<<<<<<<
  9061. * if index is Ellipsis:
  9062. * return self
  9063. */
  9064. /* function exit code */
  9065. __pyx_L1_error:;
  9066. __Pyx_XDECREF(__pyx_t_3);
  9067. __Pyx_XDECREF(__pyx_t_4);
  9068. __Pyx_XDECREF(__pyx_t_5);
  9069. __Pyx_AddTraceback("View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9070. __pyx_r = NULL;
  9071. __pyx_L0:;
  9072. __Pyx_XDECREF(__pyx_v_have_slices);
  9073. __Pyx_XDECREF(__pyx_v_indices);
  9074. __Pyx_XGIVEREF(__pyx_r);
  9075. __Pyx_RefNannyFinishContext();
  9076. return __pyx_r;
  9077. }
  9078. /* "View.MemoryView":416
  9079. * return self.convert_item_to_object(itemp)
  9080. *
  9081. * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
  9082. * if self.view.readonly:
  9083. * raise TypeError("Cannot assign to read-only memoryview")
  9084. */
  9085. /* Python wrapper */
  9086. static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value); /*proto*/
  9087. static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  9088. int __pyx_r;
  9089. __Pyx_RefNannyDeclarations
  9090. __Pyx_RefNannySetupContext("__setitem__ (wrapper)", 0);
  9091. __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));
  9092. /* function exit code */
  9093. __Pyx_RefNannyFinishContext();
  9094. return __pyx_r;
  9095. }
  9096. 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) {
  9097. PyObject *__pyx_v_have_slices = NULL;
  9098. PyObject *__pyx_v_obj = NULL;
  9099. int __pyx_r;
  9100. __Pyx_RefNannyDeclarations
  9101. int __pyx_t_1;
  9102. PyObject *__pyx_t_2 = NULL;
  9103. PyObject *__pyx_t_3 = NULL;
  9104. PyObject *__pyx_t_4 = NULL;
  9105. __Pyx_RefNannySetupContext("__setitem__", 0);
  9106. __Pyx_INCREF(__pyx_v_index);
  9107. /* "View.MemoryView":417
  9108. *
  9109. * def __setitem__(memoryview self, object index, object value):
  9110. * if self.view.readonly: # <<<<<<<<<<<<<<
  9111. * raise TypeError("Cannot assign to read-only memoryview")
  9112. *
  9113. */
  9114. __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
  9115. if (unlikely(__pyx_t_1)) {
  9116. /* "View.MemoryView":418
  9117. * def __setitem__(memoryview self, object index, object value):
  9118. * if self.view.readonly:
  9119. * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
  9120. *
  9121. * have_slices, index = _unellipsify(index, self.view.ndim)
  9122. */
  9123. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 418, __pyx_L1_error)
  9124. __Pyx_GOTREF(__pyx_t_2);
  9125. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  9126. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9127. __PYX_ERR(2, 418, __pyx_L1_error)
  9128. /* "View.MemoryView":417
  9129. *
  9130. * def __setitem__(memoryview self, object index, object value):
  9131. * if self.view.readonly: # <<<<<<<<<<<<<<
  9132. * raise TypeError("Cannot assign to read-only memoryview")
  9133. *
  9134. */
  9135. }
  9136. /* "View.MemoryView":420
  9137. * raise TypeError("Cannot assign to read-only memoryview")
  9138. *
  9139. * have_slices, index = _unellipsify(index, self.view.ndim) # <<<<<<<<<<<<<<
  9140. *
  9141. * if have_slices:
  9142. */
  9143. __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
  9144. __Pyx_GOTREF(__pyx_t_2);
  9145. if (likely(__pyx_t_2 != Py_None)) {
  9146. PyObject* sequence = __pyx_t_2;
  9147. Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
  9148. if (unlikely(size != 2)) {
  9149. if (size > 2) __Pyx_RaiseTooManyValuesError(2);
  9150. else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
  9151. __PYX_ERR(2, 420, __pyx_L1_error)
  9152. }
  9153. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  9154. __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
  9155. __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
  9156. __Pyx_INCREF(__pyx_t_3);
  9157. __Pyx_INCREF(__pyx_t_4);
  9158. #else
  9159. __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 420, __pyx_L1_error)
  9160. __Pyx_GOTREF(__pyx_t_3);
  9161. __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 420, __pyx_L1_error)
  9162. __Pyx_GOTREF(__pyx_t_4);
  9163. #endif
  9164. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9165. } else {
  9166. __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 420, __pyx_L1_error)
  9167. }
  9168. __pyx_v_have_slices = __pyx_t_3;
  9169. __pyx_t_3 = 0;
  9170. __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
  9171. __pyx_t_4 = 0;
  9172. /* "View.MemoryView":422
  9173. * have_slices, index = _unellipsify(index, self.view.ndim)
  9174. *
  9175. * if have_slices: # <<<<<<<<<<<<<<
  9176. * obj = self.is_slice(value)
  9177. * if obj:
  9178. */
  9179. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 422, __pyx_L1_error)
  9180. if (__pyx_t_1) {
  9181. /* "View.MemoryView":423
  9182. *
  9183. * if have_slices:
  9184. * obj = self.is_slice(value) # <<<<<<<<<<<<<<
  9185. * if obj:
  9186. * self.setitem_slice_assignment(self[index], obj)
  9187. */
  9188. __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(2, 423, __pyx_L1_error)
  9189. __Pyx_GOTREF(__pyx_t_2);
  9190. __pyx_v_obj = __pyx_t_2;
  9191. __pyx_t_2 = 0;
  9192. /* "View.MemoryView":424
  9193. * if have_slices:
  9194. * obj = self.is_slice(value)
  9195. * if obj: # <<<<<<<<<<<<<<
  9196. * self.setitem_slice_assignment(self[index], obj)
  9197. * else:
  9198. */
  9199. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
  9200. if (__pyx_t_1) {
  9201. /* "View.MemoryView":425
  9202. * obj = self.is_slice(value)
  9203. * if obj:
  9204. * self.setitem_slice_assignment(self[index], obj) # <<<<<<<<<<<<<<
  9205. * else:
  9206. * self.setitem_slice_assign_scalar(self[index], value)
  9207. */
  9208. __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
  9209. __Pyx_GOTREF(__pyx_t_2);
  9210. __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(2, 425, __pyx_L1_error)
  9211. __Pyx_GOTREF(__pyx_t_4);
  9212. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9213. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9214. /* "View.MemoryView":424
  9215. * if have_slices:
  9216. * obj = self.is_slice(value)
  9217. * if obj: # <<<<<<<<<<<<<<
  9218. * self.setitem_slice_assignment(self[index], obj)
  9219. * else:
  9220. */
  9221. goto __pyx_L5;
  9222. }
  9223. /* "View.MemoryView":427
  9224. * self.setitem_slice_assignment(self[index], obj)
  9225. * else:
  9226. * self.setitem_slice_assign_scalar(self[index], value) # <<<<<<<<<<<<<<
  9227. * else:
  9228. * self.setitem_indexed(index, value)
  9229. */
  9230. /*else*/ {
  9231. __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
  9232. __Pyx_GOTREF(__pyx_t_4);
  9233. if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 427, __pyx_L1_error)
  9234. __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(2, 427, __pyx_L1_error)
  9235. __Pyx_GOTREF(__pyx_t_2);
  9236. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  9237. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9238. }
  9239. __pyx_L5:;
  9240. /* "View.MemoryView":422
  9241. * have_slices, index = _unellipsify(index, self.view.ndim)
  9242. *
  9243. * if have_slices: # <<<<<<<<<<<<<<
  9244. * obj = self.is_slice(value)
  9245. * if obj:
  9246. */
  9247. goto __pyx_L4;
  9248. }
  9249. /* "View.MemoryView":429
  9250. * self.setitem_slice_assign_scalar(self[index], value)
  9251. * else:
  9252. * self.setitem_indexed(index, value) # <<<<<<<<<<<<<<
  9253. *
  9254. * cdef is_slice(self, obj):
  9255. */
  9256. /*else*/ {
  9257. __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(2, 429, __pyx_L1_error)
  9258. __Pyx_GOTREF(__pyx_t_2);
  9259. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9260. }
  9261. __pyx_L4:;
  9262. /* "View.MemoryView":416
  9263. * return self.convert_item_to_object(itemp)
  9264. *
  9265. * def __setitem__(memoryview self, object index, object value): # <<<<<<<<<<<<<<
  9266. * if self.view.readonly:
  9267. * raise TypeError("Cannot assign to read-only memoryview")
  9268. */
  9269. /* function exit code */
  9270. __pyx_r = 0;
  9271. goto __pyx_L0;
  9272. __pyx_L1_error:;
  9273. __Pyx_XDECREF(__pyx_t_2);
  9274. __Pyx_XDECREF(__pyx_t_3);
  9275. __Pyx_XDECREF(__pyx_t_4);
  9276. __Pyx_AddTraceback("View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9277. __pyx_r = -1;
  9278. __pyx_L0:;
  9279. __Pyx_XDECREF(__pyx_v_have_slices);
  9280. __Pyx_XDECREF(__pyx_v_obj);
  9281. __Pyx_XDECREF(__pyx_v_index);
  9282. __Pyx_RefNannyFinishContext();
  9283. return __pyx_r;
  9284. }
  9285. /* "View.MemoryView":431
  9286. * self.setitem_indexed(index, value)
  9287. *
  9288. * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
  9289. * if not isinstance(obj, memoryview):
  9290. * try:
  9291. */
  9292. static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
  9293. PyObject *__pyx_r = NULL;
  9294. __Pyx_RefNannyDeclarations
  9295. int __pyx_t_1;
  9296. int __pyx_t_2;
  9297. PyObject *__pyx_t_3 = NULL;
  9298. PyObject *__pyx_t_4 = NULL;
  9299. PyObject *__pyx_t_5 = NULL;
  9300. PyObject *__pyx_t_6 = NULL;
  9301. PyObject *__pyx_t_7 = NULL;
  9302. PyObject *__pyx_t_8 = NULL;
  9303. int __pyx_t_9;
  9304. __Pyx_RefNannySetupContext("is_slice", 0);
  9305. __Pyx_INCREF(__pyx_v_obj);
  9306. /* "View.MemoryView":432
  9307. *
  9308. * cdef is_slice(self, obj):
  9309. * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
  9310. * try:
  9311. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  9312. */
  9313. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
  9314. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  9315. if (__pyx_t_2) {
  9316. /* "View.MemoryView":433
  9317. * cdef is_slice(self, obj):
  9318. * if not isinstance(obj, memoryview):
  9319. * try: # <<<<<<<<<<<<<<
  9320. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  9321. * self.dtype_is_object)
  9322. */
  9323. {
  9324. __Pyx_PyThreadState_declare
  9325. __Pyx_PyThreadState_assign
  9326. __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
  9327. __Pyx_XGOTREF(__pyx_t_3);
  9328. __Pyx_XGOTREF(__pyx_t_4);
  9329. __Pyx_XGOTREF(__pyx_t_5);
  9330. /*try:*/ {
  9331. /* "View.MemoryView":434
  9332. * if not isinstance(obj, memoryview):
  9333. * try:
  9334. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
  9335. * self.dtype_is_object)
  9336. * except TypeError:
  9337. */
  9338. __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 434, __pyx_L4_error)
  9339. __Pyx_GOTREF(__pyx_t_6);
  9340. /* "View.MemoryView":435
  9341. * try:
  9342. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  9343. * self.dtype_is_object) # <<<<<<<<<<<<<<
  9344. * except TypeError:
  9345. * return None
  9346. */
  9347. __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 435, __pyx_L4_error)
  9348. __Pyx_GOTREF(__pyx_t_7);
  9349. /* "View.MemoryView":434
  9350. * if not isinstance(obj, memoryview):
  9351. * try:
  9352. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS, # <<<<<<<<<<<<<<
  9353. * self.dtype_is_object)
  9354. * except TypeError:
  9355. */
  9356. __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 434, __pyx_L4_error)
  9357. __Pyx_GOTREF(__pyx_t_8);
  9358. __Pyx_INCREF(__pyx_v_obj);
  9359. __Pyx_GIVEREF(__pyx_v_obj);
  9360. PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
  9361. __Pyx_GIVEREF(__pyx_t_6);
  9362. PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
  9363. __Pyx_GIVEREF(__pyx_t_7);
  9364. PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
  9365. __pyx_t_6 = 0;
  9366. __pyx_t_7 = 0;
  9367. __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 434, __pyx_L4_error)
  9368. __Pyx_GOTREF(__pyx_t_7);
  9369. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9370. __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
  9371. __pyx_t_7 = 0;
  9372. /* "View.MemoryView":433
  9373. * cdef is_slice(self, obj):
  9374. * if not isinstance(obj, memoryview):
  9375. * try: # <<<<<<<<<<<<<<
  9376. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  9377. * self.dtype_is_object)
  9378. */
  9379. }
  9380. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  9381. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  9382. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  9383. goto __pyx_L9_try_end;
  9384. __pyx_L4_error:;
  9385. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  9386. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  9387. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  9388. /* "View.MemoryView":436
  9389. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  9390. * self.dtype_is_object)
  9391. * except TypeError: # <<<<<<<<<<<<<<
  9392. * return None
  9393. *
  9394. */
  9395. __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
  9396. if (__pyx_t_9) {
  9397. __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9398. if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 436, __pyx_L6_except_error)
  9399. __Pyx_GOTREF(__pyx_t_7);
  9400. __Pyx_GOTREF(__pyx_t_8);
  9401. __Pyx_GOTREF(__pyx_t_6);
  9402. /* "View.MemoryView":437
  9403. * self.dtype_is_object)
  9404. * except TypeError:
  9405. * return None # <<<<<<<<<<<<<<
  9406. *
  9407. * return obj
  9408. */
  9409. __Pyx_XDECREF(__pyx_r);
  9410. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  9411. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9412. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  9413. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  9414. goto __pyx_L7_except_return;
  9415. }
  9416. goto __pyx_L6_except_error;
  9417. __pyx_L6_except_error:;
  9418. /* "View.MemoryView":433
  9419. * cdef is_slice(self, obj):
  9420. * if not isinstance(obj, memoryview):
  9421. * try: # <<<<<<<<<<<<<<
  9422. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  9423. * self.dtype_is_object)
  9424. */
  9425. __Pyx_XGIVEREF(__pyx_t_3);
  9426. __Pyx_XGIVEREF(__pyx_t_4);
  9427. __Pyx_XGIVEREF(__pyx_t_5);
  9428. __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
  9429. goto __pyx_L1_error;
  9430. __pyx_L7_except_return:;
  9431. __Pyx_XGIVEREF(__pyx_t_3);
  9432. __Pyx_XGIVEREF(__pyx_t_4);
  9433. __Pyx_XGIVEREF(__pyx_t_5);
  9434. __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
  9435. goto __pyx_L0;
  9436. __pyx_L9_try_end:;
  9437. }
  9438. /* "View.MemoryView":432
  9439. *
  9440. * cdef is_slice(self, obj):
  9441. * if not isinstance(obj, memoryview): # <<<<<<<<<<<<<<
  9442. * try:
  9443. * obj = memoryview(obj, self.flags & ~PyBUF_WRITABLE | PyBUF_ANY_CONTIGUOUS,
  9444. */
  9445. }
  9446. /* "View.MemoryView":439
  9447. * return None
  9448. *
  9449. * return obj # <<<<<<<<<<<<<<
  9450. *
  9451. * cdef setitem_slice_assignment(self, dst, src):
  9452. */
  9453. __Pyx_XDECREF(__pyx_r);
  9454. __Pyx_INCREF(__pyx_v_obj);
  9455. __pyx_r = __pyx_v_obj;
  9456. goto __pyx_L0;
  9457. /* "View.MemoryView":431
  9458. * self.setitem_indexed(index, value)
  9459. *
  9460. * cdef is_slice(self, obj): # <<<<<<<<<<<<<<
  9461. * if not isinstance(obj, memoryview):
  9462. * try:
  9463. */
  9464. /* function exit code */
  9465. __pyx_L1_error:;
  9466. __Pyx_XDECREF(__pyx_t_6);
  9467. __Pyx_XDECREF(__pyx_t_7);
  9468. __Pyx_XDECREF(__pyx_t_8);
  9469. __Pyx_AddTraceback("View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9470. __pyx_r = 0;
  9471. __pyx_L0:;
  9472. __Pyx_XDECREF(__pyx_v_obj);
  9473. __Pyx_XGIVEREF(__pyx_r);
  9474. __Pyx_RefNannyFinishContext();
  9475. return __pyx_r;
  9476. }
  9477. /* "View.MemoryView":441
  9478. * return obj
  9479. *
  9480. * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
  9481. * cdef __Pyx_memviewslice dst_slice
  9482. * cdef __Pyx_memviewslice src_slice
  9483. */
  9484. static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
  9485. __Pyx_memviewslice __pyx_v_dst_slice;
  9486. __Pyx_memviewslice __pyx_v_src_slice;
  9487. PyObject *__pyx_r = NULL;
  9488. __Pyx_RefNannyDeclarations
  9489. __Pyx_memviewslice *__pyx_t_1;
  9490. __Pyx_memviewslice *__pyx_t_2;
  9491. PyObject *__pyx_t_3 = NULL;
  9492. int __pyx_t_4;
  9493. int __pyx_t_5;
  9494. int __pyx_t_6;
  9495. __Pyx_RefNannySetupContext("setitem_slice_assignment", 0);
  9496. /* "View.MemoryView":445
  9497. * cdef __Pyx_memviewslice src_slice
  9498. *
  9499. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
  9500. * get_slice_from_memview(dst, &dst_slice)[0],
  9501. * src.ndim, dst.ndim, self.dtype_is_object)
  9502. */
  9503. if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 445, __pyx_L1_error)
  9504. __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(2, 445, __pyx_L1_error)
  9505. /* "View.MemoryView":446
  9506. *
  9507. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
  9508. * get_slice_from_memview(dst, &dst_slice)[0], # <<<<<<<<<<<<<<
  9509. * src.ndim, dst.ndim, self.dtype_is_object)
  9510. *
  9511. */
  9512. if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 446, __pyx_L1_error)
  9513. __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(2, 446, __pyx_L1_error)
  9514. /* "View.MemoryView":447
  9515. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0],
  9516. * get_slice_from_memview(dst, &dst_slice)[0],
  9517. * src.ndim, dst.ndim, self.dtype_is_object) # <<<<<<<<<<<<<<
  9518. *
  9519. * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  9520. */
  9521. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
  9522. __Pyx_GOTREF(__pyx_t_3);
  9523. __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
  9524. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9525. __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 447, __pyx_L1_error)
  9526. __Pyx_GOTREF(__pyx_t_3);
  9527. __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(2, 447, __pyx_L1_error)
  9528. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9529. /* "View.MemoryView":445
  9530. * cdef __Pyx_memviewslice src_slice
  9531. *
  9532. * memoryview_copy_contents(get_slice_from_memview(src, &src_slice)[0], # <<<<<<<<<<<<<<
  9533. * get_slice_from_memview(dst, &dst_slice)[0],
  9534. * src.ndim, dst.ndim, self.dtype_is_object)
  9535. */
  9536. __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(2, 445, __pyx_L1_error)
  9537. /* "View.MemoryView":441
  9538. * return obj
  9539. *
  9540. * cdef setitem_slice_assignment(self, dst, src): # <<<<<<<<<<<<<<
  9541. * cdef __Pyx_memviewslice dst_slice
  9542. * cdef __Pyx_memviewslice src_slice
  9543. */
  9544. /* function exit code */
  9545. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  9546. goto __pyx_L0;
  9547. __pyx_L1_error:;
  9548. __Pyx_XDECREF(__pyx_t_3);
  9549. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9550. __pyx_r = 0;
  9551. __pyx_L0:;
  9552. __Pyx_XGIVEREF(__pyx_r);
  9553. __Pyx_RefNannyFinishContext();
  9554. return __pyx_r;
  9555. }
  9556. /* "View.MemoryView":449
  9557. * src.ndim, dst.ndim, self.dtype_is_object)
  9558. *
  9559. * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
  9560. * cdef int array[128]
  9561. * cdef void *tmp = NULL
  9562. */
  9563. 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) {
  9564. int __pyx_v_array[0x80];
  9565. void *__pyx_v_tmp;
  9566. void *__pyx_v_item;
  9567. __Pyx_memviewslice *__pyx_v_dst_slice;
  9568. __Pyx_memviewslice __pyx_v_tmp_slice;
  9569. PyObject *__pyx_r = NULL;
  9570. __Pyx_RefNannyDeclarations
  9571. __Pyx_memviewslice *__pyx_t_1;
  9572. int __pyx_t_2;
  9573. PyObject *__pyx_t_3 = NULL;
  9574. int __pyx_t_4;
  9575. int __pyx_t_5;
  9576. char const *__pyx_t_6;
  9577. PyObject *__pyx_t_7 = NULL;
  9578. PyObject *__pyx_t_8 = NULL;
  9579. PyObject *__pyx_t_9 = NULL;
  9580. PyObject *__pyx_t_10 = NULL;
  9581. PyObject *__pyx_t_11 = NULL;
  9582. PyObject *__pyx_t_12 = NULL;
  9583. __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0);
  9584. /* "View.MemoryView":451
  9585. * cdef setitem_slice_assign_scalar(self, memoryview dst, value):
  9586. * cdef int array[128]
  9587. * cdef void *tmp = NULL # <<<<<<<<<<<<<<
  9588. * cdef void *item
  9589. *
  9590. */
  9591. __pyx_v_tmp = NULL;
  9592. /* "View.MemoryView":456
  9593. * cdef __Pyx_memviewslice *dst_slice
  9594. * cdef __Pyx_memviewslice tmp_slice
  9595. * dst_slice = get_slice_from_memview(dst, &tmp_slice) # <<<<<<<<<<<<<<
  9596. *
  9597. * if <size_t>self.view.itemsize > sizeof(array):
  9598. */
  9599. __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(2, 456, __pyx_L1_error)
  9600. __pyx_v_dst_slice = __pyx_t_1;
  9601. /* "View.MemoryView":458
  9602. * dst_slice = get_slice_from_memview(dst, &tmp_slice)
  9603. *
  9604. * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
  9605. * tmp = PyMem_Malloc(self.view.itemsize)
  9606. * if tmp == NULL:
  9607. */
  9608. __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (sizeof(__pyx_v_array))) != 0);
  9609. if (__pyx_t_2) {
  9610. /* "View.MemoryView":459
  9611. *
  9612. * if <size_t>self.view.itemsize > sizeof(array):
  9613. * tmp = PyMem_Malloc(self.view.itemsize) # <<<<<<<<<<<<<<
  9614. * if tmp == NULL:
  9615. * raise MemoryError
  9616. */
  9617. __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
  9618. /* "View.MemoryView":460
  9619. * if <size_t>self.view.itemsize > sizeof(array):
  9620. * tmp = PyMem_Malloc(self.view.itemsize)
  9621. * if tmp == NULL: # <<<<<<<<<<<<<<
  9622. * raise MemoryError
  9623. * item = tmp
  9624. */
  9625. __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
  9626. if (unlikely(__pyx_t_2)) {
  9627. /* "View.MemoryView":461
  9628. * tmp = PyMem_Malloc(self.view.itemsize)
  9629. * if tmp == NULL:
  9630. * raise MemoryError # <<<<<<<<<<<<<<
  9631. * item = tmp
  9632. * else:
  9633. */
  9634. PyErr_NoMemory(); __PYX_ERR(2, 461, __pyx_L1_error)
  9635. /* "View.MemoryView":460
  9636. * if <size_t>self.view.itemsize > sizeof(array):
  9637. * tmp = PyMem_Malloc(self.view.itemsize)
  9638. * if tmp == NULL: # <<<<<<<<<<<<<<
  9639. * raise MemoryError
  9640. * item = tmp
  9641. */
  9642. }
  9643. /* "View.MemoryView":462
  9644. * if tmp == NULL:
  9645. * raise MemoryError
  9646. * item = tmp # <<<<<<<<<<<<<<
  9647. * else:
  9648. * item = <void *> array
  9649. */
  9650. __pyx_v_item = __pyx_v_tmp;
  9651. /* "View.MemoryView":458
  9652. * dst_slice = get_slice_from_memview(dst, &tmp_slice)
  9653. *
  9654. * if <size_t>self.view.itemsize > sizeof(array): # <<<<<<<<<<<<<<
  9655. * tmp = PyMem_Malloc(self.view.itemsize)
  9656. * if tmp == NULL:
  9657. */
  9658. goto __pyx_L3;
  9659. }
  9660. /* "View.MemoryView":464
  9661. * item = tmp
  9662. * else:
  9663. * item = <void *> array # <<<<<<<<<<<<<<
  9664. *
  9665. * try:
  9666. */
  9667. /*else*/ {
  9668. __pyx_v_item = ((void *)__pyx_v_array);
  9669. }
  9670. __pyx_L3:;
  9671. /* "View.MemoryView":466
  9672. * item = <void *> array
  9673. *
  9674. * try: # <<<<<<<<<<<<<<
  9675. * if self.dtype_is_object:
  9676. * (<PyObject **> item)[0] = <PyObject *> value
  9677. */
  9678. /*try:*/ {
  9679. /* "View.MemoryView":467
  9680. *
  9681. * try:
  9682. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  9683. * (<PyObject **> item)[0] = <PyObject *> value
  9684. * else:
  9685. */
  9686. __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
  9687. if (__pyx_t_2) {
  9688. /* "View.MemoryView":468
  9689. * try:
  9690. * if self.dtype_is_object:
  9691. * (<PyObject **> item)[0] = <PyObject *> value # <<<<<<<<<<<<<<
  9692. * else:
  9693. * self.assign_item_from_object(<char *> item, value)
  9694. */
  9695. (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
  9696. /* "View.MemoryView":467
  9697. *
  9698. * try:
  9699. * if self.dtype_is_object: # <<<<<<<<<<<<<<
  9700. * (<PyObject **> item)[0] = <PyObject *> value
  9701. * else:
  9702. */
  9703. goto __pyx_L8;
  9704. }
  9705. /* "View.MemoryView":470
  9706. * (<PyObject **> item)[0] = <PyObject *> value
  9707. * else:
  9708. * self.assign_item_from_object(<char *> item, value) # <<<<<<<<<<<<<<
  9709. *
  9710. *
  9711. */
  9712. /*else*/ {
  9713. __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(2, 470, __pyx_L6_error)
  9714. __Pyx_GOTREF(__pyx_t_3);
  9715. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9716. }
  9717. __pyx_L8:;
  9718. /* "View.MemoryView":474
  9719. *
  9720. *
  9721. * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
  9722. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  9723. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  9724. */
  9725. __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
  9726. if (__pyx_t_2) {
  9727. /* "View.MemoryView":475
  9728. *
  9729. * if self.view.suboffsets != NULL:
  9730. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim) # <<<<<<<<<<<<<<
  9731. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  9732. * item, self.dtype_is_object)
  9733. */
  9734. __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 475, __pyx_L6_error)
  9735. __Pyx_GOTREF(__pyx_t_3);
  9736. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  9737. /* "View.MemoryView":474
  9738. *
  9739. *
  9740. * if self.view.suboffsets != NULL: # <<<<<<<<<<<<<<
  9741. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  9742. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize,
  9743. */
  9744. }
  9745. /* "View.MemoryView":476
  9746. * if self.view.suboffsets != NULL:
  9747. * assert_direct_dimensions(self.view.suboffsets, self.view.ndim)
  9748. * slice_assign_scalar(dst_slice, dst.view.ndim, self.view.itemsize, # <<<<<<<<<<<<<<
  9749. * item, self.dtype_is_object)
  9750. * finally:
  9751. */
  9752. __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);
  9753. }
  9754. /* "View.MemoryView":479
  9755. * item, self.dtype_is_object)
  9756. * finally:
  9757. * PyMem_Free(tmp) # <<<<<<<<<<<<<<
  9758. *
  9759. * cdef setitem_indexed(self, index, value):
  9760. */
  9761. /*finally:*/ {
  9762. /*normal exit:*/{
  9763. PyMem_Free(__pyx_v_tmp);
  9764. goto __pyx_L7;
  9765. }
  9766. __pyx_L6_error:;
  9767. /*exception exit:*/{
  9768. __Pyx_PyThreadState_declare
  9769. __Pyx_PyThreadState_assign
  9770. __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
  9771. __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  9772. if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
  9773. 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);
  9774. __Pyx_XGOTREF(__pyx_t_7);
  9775. __Pyx_XGOTREF(__pyx_t_8);
  9776. __Pyx_XGOTREF(__pyx_t_9);
  9777. __Pyx_XGOTREF(__pyx_t_10);
  9778. __Pyx_XGOTREF(__pyx_t_11);
  9779. __Pyx_XGOTREF(__pyx_t_12);
  9780. __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
  9781. {
  9782. PyMem_Free(__pyx_v_tmp);
  9783. }
  9784. if (PY_MAJOR_VERSION >= 3) {
  9785. __Pyx_XGIVEREF(__pyx_t_10);
  9786. __Pyx_XGIVEREF(__pyx_t_11);
  9787. __Pyx_XGIVEREF(__pyx_t_12);
  9788. __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
  9789. }
  9790. __Pyx_XGIVEREF(__pyx_t_7);
  9791. __Pyx_XGIVEREF(__pyx_t_8);
  9792. __Pyx_XGIVEREF(__pyx_t_9);
  9793. __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
  9794. __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
  9795. __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
  9796. goto __pyx_L1_error;
  9797. }
  9798. __pyx_L7:;
  9799. }
  9800. /* "View.MemoryView":449
  9801. * src.ndim, dst.ndim, self.dtype_is_object)
  9802. *
  9803. * cdef setitem_slice_assign_scalar(self, memoryview dst, value): # <<<<<<<<<<<<<<
  9804. * cdef int array[128]
  9805. * cdef void *tmp = NULL
  9806. */
  9807. /* function exit code */
  9808. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  9809. goto __pyx_L0;
  9810. __pyx_L1_error:;
  9811. __Pyx_XDECREF(__pyx_t_3);
  9812. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9813. __pyx_r = 0;
  9814. __pyx_L0:;
  9815. __Pyx_XGIVEREF(__pyx_r);
  9816. __Pyx_RefNannyFinishContext();
  9817. return __pyx_r;
  9818. }
  9819. /* "View.MemoryView":481
  9820. * PyMem_Free(tmp)
  9821. *
  9822. * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
  9823. * cdef char *itemp = self.get_item_pointer(index)
  9824. * self.assign_item_from_object(itemp, value)
  9825. */
  9826. static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
  9827. char *__pyx_v_itemp;
  9828. PyObject *__pyx_r = NULL;
  9829. __Pyx_RefNannyDeclarations
  9830. char *__pyx_t_1;
  9831. PyObject *__pyx_t_2 = NULL;
  9832. __Pyx_RefNannySetupContext("setitem_indexed", 0);
  9833. /* "View.MemoryView":482
  9834. *
  9835. * cdef setitem_indexed(self, index, value):
  9836. * cdef char *itemp = self.get_item_pointer(index) # <<<<<<<<<<<<<<
  9837. * self.assign_item_from_object(itemp, value)
  9838. *
  9839. */
  9840. __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(2, 482, __pyx_L1_error)
  9841. __pyx_v_itemp = __pyx_t_1;
  9842. /* "View.MemoryView":483
  9843. * cdef setitem_indexed(self, index, value):
  9844. * cdef char *itemp = self.get_item_pointer(index)
  9845. * self.assign_item_from_object(itemp, value) # <<<<<<<<<<<<<<
  9846. *
  9847. * cdef convert_item_to_object(self, char *itemp):
  9848. */
  9849. __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(2, 483, __pyx_L1_error)
  9850. __Pyx_GOTREF(__pyx_t_2);
  9851. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  9852. /* "View.MemoryView":481
  9853. * PyMem_Free(tmp)
  9854. *
  9855. * cdef setitem_indexed(self, index, value): # <<<<<<<<<<<<<<
  9856. * cdef char *itemp = self.get_item_pointer(index)
  9857. * self.assign_item_from_object(itemp, value)
  9858. */
  9859. /* function exit code */
  9860. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  9861. goto __pyx_L0;
  9862. __pyx_L1_error:;
  9863. __Pyx_XDECREF(__pyx_t_2);
  9864. __Pyx_AddTraceback("View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
  9865. __pyx_r = 0;
  9866. __pyx_L0:;
  9867. __Pyx_XGIVEREF(__pyx_r);
  9868. __Pyx_RefNannyFinishContext();
  9869. return __pyx_r;
  9870. }
  9871. /* "View.MemoryView":485
  9872. * self.assign_item_from_object(itemp, value)
  9873. *
  9874. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  9875. * """Only used if instantiated manually by the user, or if Cython doesn't
  9876. * know how to convert the type"""
  9877. */
  9878. static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp) {
  9879. PyObject *__pyx_v_struct = NULL;
  9880. PyObject *__pyx_v_bytesitem = 0;
  9881. PyObject *__pyx_v_result = NULL;
  9882. PyObject *__pyx_r = NULL;
  9883. __Pyx_RefNannyDeclarations
  9884. PyObject *__pyx_t_1 = NULL;
  9885. PyObject *__pyx_t_2 = NULL;
  9886. PyObject *__pyx_t_3 = NULL;
  9887. PyObject *__pyx_t_4 = NULL;
  9888. PyObject *__pyx_t_5 = NULL;
  9889. PyObject *__pyx_t_6 = NULL;
  9890. PyObject *__pyx_t_7 = NULL;
  9891. int __pyx_t_8;
  9892. PyObject *__pyx_t_9 = NULL;
  9893. size_t __pyx_t_10;
  9894. int __pyx_t_11;
  9895. __Pyx_RefNannySetupContext("convert_item_to_object", 0);
  9896. /* "View.MemoryView":488
  9897. * """Only used if instantiated manually by the user, or if Cython doesn't
  9898. * know how to convert the type"""
  9899. * import struct # <<<<<<<<<<<<<<
  9900. * cdef bytes bytesitem
  9901. *
  9902. */
  9903. __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 488, __pyx_L1_error)
  9904. __Pyx_GOTREF(__pyx_t_1);
  9905. __pyx_v_struct = __pyx_t_1;
  9906. __pyx_t_1 = 0;
  9907. /* "View.MemoryView":491
  9908. * cdef bytes bytesitem
  9909. *
  9910. * bytesitem = itemp[:self.view.itemsize] # <<<<<<<<<<<<<<
  9911. * try:
  9912. * result = struct.unpack(self.view.format, bytesitem)
  9913. */
  9914. __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 491, __pyx_L1_error)
  9915. __Pyx_GOTREF(__pyx_t_1);
  9916. __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
  9917. __pyx_t_1 = 0;
  9918. /* "View.MemoryView":492
  9919. *
  9920. * bytesitem = itemp[:self.view.itemsize]
  9921. * try: # <<<<<<<<<<<<<<
  9922. * result = struct.unpack(self.view.format, bytesitem)
  9923. * except struct.error:
  9924. */
  9925. {
  9926. __Pyx_PyThreadState_declare
  9927. __Pyx_PyThreadState_assign
  9928. __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
  9929. __Pyx_XGOTREF(__pyx_t_2);
  9930. __Pyx_XGOTREF(__pyx_t_3);
  9931. __Pyx_XGOTREF(__pyx_t_4);
  9932. /*try:*/ {
  9933. /* "View.MemoryView":493
  9934. * bytesitem = itemp[:self.view.itemsize]
  9935. * try:
  9936. * result = struct.unpack(self.view.format, bytesitem) # <<<<<<<<<<<<<<
  9937. * except struct.error:
  9938. * raise ValueError("Unable to convert item to object")
  9939. */
  9940. __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 493, __pyx_L3_error)
  9941. __Pyx_GOTREF(__pyx_t_5);
  9942. __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 493, __pyx_L3_error)
  9943. __Pyx_GOTREF(__pyx_t_6);
  9944. __pyx_t_7 = NULL;
  9945. __pyx_t_8 = 0;
  9946. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
  9947. __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
  9948. if (likely(__pyx_t_7)) {
  9949. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
  9950. __Pyx_INCREF(__pyx_t_7);
  9951. __Pyx_INCREF(function);
  9952. __Pyx_DECREF_SET(__pyx_t_5, function);
  9953. __pyx_t_8 = 1;
  9954. }
  9955. }
  9956. #if CYTHON_FAST_PYCALL
  9957. if (PyFunction_Check(__pyx_t_5)) {
  9958. PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
  9959. __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(2, 493, __pyx_L3_error)
  9960. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  9961. __Pyx_GOTREF(__pyx_t_1);
  9962. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9963. } else
  9964. #endif
  9965. #if CYTHON_FAST_PYCCALL
  9966. if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
  9967. PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
  9968. __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(2, 493, __pyx_L3_error)
  9969. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  9970. __Pyx_GOTREF(__pyx_t_1);
  9971. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  9972. } else
  9973. #endif
  9974. {
  9975. __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 493, __pyx_L3_error)
  9976. __Pyx_GOTREF(__pyx_t_9);
  9977. if (__pyx_t_7) {
  9978. __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
  9979. }
  9980. __Pyx_GIVEREF(__pyx_t_6);
  9981. PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
  9982. __Pyx_INCREF(__pyx_v_bytesitem);
  9983. __Pyx_GIVEREF(__pyx_v_bytesitem);
  9984. PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
  9985. __pyx_t_6 = 0;
  9986. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L3_error)
  9987. __Pyx_GOTREF(__pyx_t_1);
  9988. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  9989. }
  9990. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  9991. __pyx_v_result = __pyx_t_1;
  9992. __pyx_t_1 = 0;
  9993. /* "View.MemoryView":492
  9994. *
  9995. * bytesitem = itemp[:self.view.itemsize]
  9996. * try: # <<<<<<<<<<<<<<
  9997. * result = struct.unpack(self.view.format, bytesitem)
  9998. * except struct.error:
  9999. */
  10000. }
  10001. /* "View.MemoryView":497
  10002. * raise ValueError("Unable to convert item to object")
  10003. * else:
  10004. * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
  10005. * return result[0]
  10006. * return result
  10007. */
  10008. /*else:*/ {
  10009. __pyx_t_10 = strlen(__pyx_v_self->view.format);
  10010. __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
  10011. if (__pyx_t_11) {
  10012. /* "View.MemoryView":498
  10013. * else:
  10014. * if len(self.view.format) == 1:
  10015. * return result[0] # <<<<<<<<<<<<<<
  10016. * return result
  10017. *
  10018. */
  10019. __Pyx_XDECREF(__pyx_r);
  10020. __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(2, 498, __pyx_L5_except_error)
  10021. __Pyx_GOTREF(__pyx_t_1);
  10022. __pyx_r = __pyx_t_1;
  10023. __pyx_t_1 = 0;
  10024. goto __pyx_L6_except_return;
  10025. /* "View.MemoryView":497
  10026. * raise ValueError("Unable to convert item to object")
  10027. * else:
  10028. * if len(self.view.format) == 1: # <<<<<<<<<<<<<<
  10029. * return result[0]
  10030. * return result
  10031. */
  10032. }
  10033. /* "View.MemoryView":499
  10034. * if len(self.view.format) == 1:
  10035. * return result[0]
  10036. * return result # <<<<<<<<<<<<<<
  10037. *
  10038. * cdef assign_item_from_object(self, char *itemp, object value):
  10039. */
  10040. __Pyx_XDECREF(__pyx_r);
  10041. __Pyx_INCREF(__pyx_v_result);
  10042. __pyx_r = __pyx_v_result;
  10043. goto __pyx_L6_except_return;
  10044. }
  10045. __pyx_L3_error:;
  10046. __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
  10047. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  10048. __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  10049. __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  10050. __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
  10051. /* "View.MemoryView":494
  10052. * try:
  10053. * result = struct.unpack(self.view.format, bytesitem)
  10054. * except struct.error: # <<<<<<<<<<<<<<
  10055. * raise ValueError("Unable to convert item to object")
  10056. * else:
  10057. */
  10058. __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
  10059. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 494, __pyx_L5_except_error)
  10060. __Pyx_GOTREF(__pyx_t_6);
  10061. __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
  10062. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10063. __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
  10064. __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
  10065. if (__pyx_t_8) {
  10066. __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10067. if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 494, __pyx_L5_except_error)
  10068. __Pyx_GOTREF(__pyx_t_9);
  10069. __Pyx_GOTREF(__pyx_t_5);
  10070. __Pyx_GOTREF(__pyx_t_1);
  10071. /* "View.MemoryView":495
  10072. * result = struct.unpack(self.view.format, bytesitem)
  10073. * except struct.error:
  10074. * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
  10075. * else:
  10076. * if len(self.view.format) == 1:
  10077. */
  10078. __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L5_except_error)
  10079. __Pyx_GOTREF(__pyx_t_6);
  10080. __Pyx_Raise(__pyx_t_6, 0, 0, 0);
  10081. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10082. __PYX_ERR(2, 495, __pyx_L5_except_error)
  10083. }
  10084. goto __pyx_L5_except_error;
  10085. __pyx_L5_except_error:;
  10086. /* "View.MemoryView":492
  10087. *
  10088. * bytesitem = itemp[:self.view.itemsize]
  10089. * try: # <<<<<<<<<<<<<<
  10090. * result = struct.unpack(self.view.format, bytesitem)
  10091. * except struct.error:
  10092. */
  10093. __Pyx_XGIVEREF(__pyx_t_2);
  10094. __Pyx_XGIVEREF(__pyx_t_3);
  10095. __Pyx_XGIVEREF(__pyx_t_4);
  10096. __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
  10097. goto __pyx_L1_error;
  10098. __pyx_L6_except_return:;
  10099. __Pyx_XGIVEREF(__pyx_t_2);
  10100. __Pyx_XGIVEREF(__pyx_t_3);
  10101. __Pyx_XGIVEREF(__pyx_t_4);
  10102. __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
  10103. goto __pyx_L0;
  10104. }
  10105. /* "View.MemoryView":485
  10106. * self.assign_item_from_object(itemp, value)
  10107. *
  10108. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  10109. * """Only used if instantiated manually by the user, or if Cython doesn't
  10110. * know how to convert the type"""
  10111. */
  10112. /* function exit code */
  10113. __pyx_L1_error:;
  10114. __Pyx_XDECREF(__pyx_t_1);
  10115. __Pyx_XDECREF(__pyx_t_5);
  10116. __Pyx_XDECREF(__pyx_t_6);
  10117. __Pyx_XDECREF(__pyx_t_7);
  10118. __Pyx_XDECREF(__pyx_t_9);
  10119. __Pyx_AddTraceback("View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10120. __pyx_r = 0;
  10121. __pyx_L0:;
  10122. __Pyx_XDECREF(__pyx_v_struct);
  10123. __Pyx_XDECREF(__pyx_v_bytesitem);
  10124. __Pyx_XDECREF(__pyx_v_result);
  10125. __Pyx_XGIVEREF(__pyx_r);
  10126. __Pyx_RefNannyFinishContext();
  10127. return __pyx_r;
  10128. }
  10129. /* "View.MemoryView":501
  10130. * return result
  10131. *
  10132. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  10133. * """Only used if instantiated manually by the user, or if Cython doesn't
  10134. * know how to convert the type"""
  10135. */
  10136. static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryview_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  10137. PyObject *__pyx_v_struct = NULL;
  10138. char __pyx_v_c;
  10139. PyObject *__pyx_v_bytesvalue = 0;
  10140. Py_ssize_t __pyx_v_i;
  10141. PyObject *__pyx_r = NULL;
  10142. __Pyx_RefNannyDeclarations
  10143. PyObject *__pyx_t_1 = NULL;
  10144. int __pyx_t_2;
  10145. int __pyx_t_3;
  10146. PyObject *__pyx_t_4 = NULL;
  10147. PyObject *__pyx_t_5 = NULL;
  10148. PyObject *__pyx_t_6 = NULL;
  10149. int __pyx_t_7;
  10150. PyObject *__pyx_t_8 = NULL;
  10151. Py_ssize_t __pyx_t_9;
  10152. PyObject *__pyx_t_10 = NULL;
  10153. char *__pyx_t_11;
  10154. char *__pyx_t_12;
  10155. char *__pyx_t_13;
  10156. char *__pyx_t_14;
  10157. __Pyx_RefNannySetupContext("assign_item_from_object", 0);
  10158. /* "View.MemoryView":504
  10159. * """Only used if instantiated manually by the user, or if Cython doesn't
  10160. * know how to convert the type"""
  10161. * import struct # <<<<<<<<<<<<<<
  10162. * cdef char c
  10163. * cdef bytes bytesvalue
  10164. */
  10165. __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 504, __pyx_L1_error)
  10166. __Pyx_GOTREF(__pyx_t_1);
  10167. __pyx_v_struct = __pyx_t_1;
  10168. __pyx_t_1 = 0;
  10169. /* "View.MemoryView":509
  10170. * cdef Py_ssize_t i
  10171. *
  10172. * if isinstance(value, tuple): # <<<<<<<<<<<<<<
  10173. * bytesvalue = struct.pack(self.view.format, *value)
  10174. * else:
  10175. */
  10176. __pyx_t_2 = PyTuple_Check(__pyx_v_value);
  10177. __pyx_t_3 = (__pyx_t_2 != 0);
  10178. if (__pyx_t_3) {
  10179. /* "View.MemoryView":510
  10180. *
  10181. * if isinstance(value, tuple):
  10182. * bytesvalue = struct.pack(self.view.format, *value) # <<<<<<<<<<<<<<
  10183. * else:
  10184. * bytesvalue = struct.pack(self.view.format, value)
  10185. */
  10186. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 510, __pyx_L1_error)
  10187. __Pyx_GOTREF(__pyx_t_1);
  10188. __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
  10189. __Pyx_GOTREF(__pyx_t_4);
  10190. __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 510, __pyx_L1_error)
  10191. __Pyx_GOTREF(__pyx_t_5);
  10192. __Pyx_GIVEREF(__pyx_t_4);
  10193. PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
  10194. __pyx_t_4 = 0;
  10195. __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
  10196. __Pyx_GOTREF(__pyx_t_4);
  10197. __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 510, __pyx_L1_error)
  10198. __Pyx_GOTREF(__pyx_t_6);
  10199. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10200. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  10201. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 510, __pyx_L1_error)
  10202. __Pyx_GOTREF(__pyx_t_4);
  10203. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10204. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10205. 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(2, 510, __pyx_L1_error)
  10206. __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
  10207. __pyx_t_4 = 0;
  10208. /* "View.MemoryView":509
  10209. * cdef Py_ssize_t i
  10210. *
  10211. * if isinstance(value, tuple): # <<<<<<<<<<<<<<
  10212. * bytesvalue = struct.pack(self.view.format, *value)
  10213. * else:
  10214. */
  10215. goto __pyx_L3;
  10216. }
  10217. /* "View.MemoryView":512
  10218. * bytesvalue = struct.pack(self.view.format, *value)
  10219. * else:
  10220. * bytesvalue = struct.pack(self.view.format, value) # <<<<<<<<<<<<<<
  10221. *
  10222. * for i, c in enumerate(bytesvalue):
  10223. */
  10224. /*else*/ {
  10225. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
  10226. __Pyx_GOTREF(__pyx_t_6);
  10227. __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
  10228. __Pyx_GOTREF(__pyx_t_1);
  10229. __pyx_t_5 = NULL;
  10230. __pyx_t_7 = 0;
  10231. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
  10232. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
  10233. if (likely(__pyx_t_5)) {
  10234. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
  10235. __Pyx_INCREF(__pyx_t_5);
  10236. __Pyx_INCREF(function);
  10237. __Pyx_DECREF_SET(__pyx_t_6, function);
  10238. __pyx_t_7 = 1;
  10239. }
  10240. }
  10241. #if CYTHON_FAST_PYCALL
  10242. if (PyFunction_Check(__pyx_t_6)) {
  10243. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
  10244. __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(2, 512, __pyx_L1_error)
  10245. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  10246. __Pyx_GOTREF(__pyx_t_4);
  10247. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10248. } else
  10249. #endif
  10250. #if CYTHON_FAST_PYCCALL
  10251. if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
  10252. PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
  10253. __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(2, 512, __pyx_L1_error)
  10254. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  10255. __Pyx_GOTREF(__pyx_t_4);
  10256. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10257. } else
  10258. #endif
  10259. {
  10260. __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 512, __pyx_L1_error)
  10261. __Pyx_GOTREF(__pyx_t_8);
  10262. if (__pyx_t_5) {
  10263. __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
  10264. }
  10265. __Pyx_GIVEREF(__pyx_t_1);
  10266. PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
  10267. __Pyx_INCREF(__pyx_v_value);
  10268. __Pyx_GIVEREF(__pyx_v_value);
  10269. PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
  10270. __pyx_t_1 = 0;
  10271. __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
  10272. __Pyx_GOTREF(__pyx_t_4);
  10273. __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  10274. }
  10275. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10276. 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(2, 512, __pyx_L1_error)
  10277. __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
  10278. __pyx_t_4 = 0;
  10279. }
  10280. __pyx_L3:;
  10281. /* "View.MemoryView":514
  10282. * bytesvalue = struct.pack(self.view.format, value)
  10283. *
  10284. * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
  10285. * itemp[i] = c
  10286. *
  10287. */
  10288. __pyx_t_9 = 0;
  10289. if (unlikely(__pyx_v_bytesvalue == Py_None)) {
  10290. PyErr_SetString(PyExc_TypeError, "'NoneType' is not iterable");
  10291. __PYX_ERR(2, 514, __pyx_L1_error)
  10292. }
  10293. __Pyx_INCREF(__pyx_v_bytesvalue);
  10294. __pyx_t_10 = __pyx_v_bytesvalue;
  10295. __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
  10296. __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
  10297. for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
  10298. __pyx_t_11 = __pyx_t_14;
  10299. __pyx_v_c = (__pyx_t_11[0]);
  10300. /* "View.MemoryView":515
  10301. *
  10302. * for i, c in enumerate(bytesvalue):
  10303. * itemp[i] = c # <<<<<<<<<<<<<<
  10304. *
  10305. * @cname('getbuffer')
  10306. */
  10307. __pyx_v_i = __pyx_t_9;
  10308. /* "View.MemoryView":514
  10309. * bytesvalue = struct.pack(self.view.format, value)
  10310. *
  10311. * for i, c in enumerate(bytesvalue): # <<<<<<<<<<<<<<
  10312. * itemp[i] = c
  10313. *
  10314. */
  10315. __pyx_t_9 = (__pyx_t_9 + 1);
  10316. /* "View.MemoryView":515
  10317. *
  10318. * for i, c in enumerate(bytesvalue):
  10319. * itemp[i] = c # <<<<<<<<<<<<<<
  10320. *
  10321. * @cname('getbuffer')
  10322. */
  10323. (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
  10324. }
  10325. __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  10326. /* "View.MemoryView":501
  10327. * return result
  10328. *
  10329. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  10330. * """Only used if instantiated manually by the user, or if Cython doesn't
  10331. * know how to convert the type"""
  10332. */
  10333. /* function exit code */
  10334. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  10335. goto __pyx_L0;
  10336. __pyx_L1_error:;
  10337. __Pyx_XDECREF(__pyx_t_1);
  10338. __Pyx_XDECREF(__pyx_t_4);
  10339. __Pyx_XDECREF(__pyx_t_5);
  10340. __Pyx_XDECREF(__pyx_t_6);
  10341. __Pyx_XDECREF(__pyx_t_8);
  10342. __Pyx_XDECREF(__pyx_t_10);
  10343. __Pyx_AddTraceback("View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10344. __pyx_r = 0;
  10345. __pyx_L0:;
  10346. __Pyx_XDECREF(__pyx_v_struct);
  10347. __Pyx_XDECREF(__pyx_v_bytesvalue);
  10348. __Pyx_XGIVEREF(__pyx_r);
  10349. __Pyx_RefNannyFinishContext();
  10350. return __pyx_r;
  10351. }
  10352. /* "View.MemoryView":518
  10353. *
  10354. * @cname('getbuffer')
  10355. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  10356. * if flags & PyBUF_WRITABLE and self.view.readonly:
  10357. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  10358. */
  10359. /* Python wrapper */
  10360. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
  10361. static CYTHON_UNUSED int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
  10362. int __pyx_r;
  10363. __Pyx_RefNannyDeclarations
  10364. __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
  10365. __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));
  10366. /* function exit code */
  10367. __Pyx_RefNannyFinishContext();
  10368. return __pyx_r;
  10369. }
  10370. 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) {
  10371. int __pyx_r;
  10372. __Pyx_RefNannyDeclarations
  10373. int __pyx_t_1;
  10374. int __pyx_t_2;
  10375. PyObject *__pyx_t_3 = NULL;
  10376. Py_ssize_t *__pyx_t_4;
  10377. char *__pyx_t_5;
  10378. void *__pyx_t_6;
  10379. int __pyx_t_7;
  10380. Py_ssize_t __pyx_t_8;
  10381. if (__pyx_v_info == NULL) {
  10382. PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete");
  10383. return -1;
  10384. }
  10385. __Pyx_RefNannySetupContext("__getbuffer__", 0);
  10386. __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
  10387. __Pyx_GIVEREF(__pyx_v_info->obj);
  10388. /* "View.MemoryView":519
  10389. * @cname('getbuffer')
  10390. * def __getbuffer__(self, Py_buffer *info, int flags):
  10391. * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
  10392. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  10393. *
  10394. */
  10395. __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
  10396. if (__pyx_t_2) {
  10397. } else {
  10398. __pyx_t_1 = __pyx_t_2;
  10399. goto __pyx_L4_bool_binop_done;
  10400. }
  10401. __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
  10402. __pyx_t_1 = __pyx_t_2;
  10403. __pyx_L4_bool_binop_done:;
  10404. if (unlikely(__pyx_t_1)) {
  10405. /* "View.MemoryView":520
  10406. * def __getbuffer__(self, Py_buffer *info, int flags):
  10407. * if flags & PyBUF_WRITABLE and self.view.readonly:
  10408. * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
  10409. *
  10410. * if flags & PyBUF_ND:
  10411. */
  10412. __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 520, __pyx_L1_error)
  10413. __Pyx_GOTREF(__pyx_t_3);
  10414. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  10415. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  10416. __PYX_ERR(2, 520, __pyx_L1_error)
  10417. /* "View.MemoryView":519
  10418. * @cname('getbuffer')
  10419. * def __getbuffer__(self, Py_buffer *info, int flags):
  10420. * if flags & PyBUF_WRITABLE and self.view.readonly: # <<<<<<<<<<<<<<
  10421. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  10422. *
  10423. */
  10424. }
  10425. /* "View.MemoryView":522
  10426. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  10427. *
  10428. * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
  10429. * info.shape = self.view.shape
  10430. * else:
  10431. */
  10432. __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
  10433. if (__pyx_t_1) {
  10434. /* "View.MemoryView":523
  10435. *
  10436. * if flags & PyBUF_ND:
  10437. * info.shape = self.view.shape # <<<<<<<<<<<<<<
  10438. * else:
  10439. * info.shape = NULL
  10440. */
  10441. __pyx_t_4 = __pyx_v_self->view.shape;
  10442. __pyx_v_info->shape = __pyx_t_4;
  10443. /* "View.MemoryView":522
  10444. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  10445. *
  10446. * if flags & PyBUF_ND: # <<<<<<<<<<<<<<
  10447. * info.shape = self.view.shape
  10448. * else:
  10449. */
  10450. goto __pyx_L6;
  10451. }
  10452. /* "View.MemoryView":525
  10453. * info.shape = self.view.shape
  10454. * else:
  10455. * info.shape = NULL # <<<<<<<<<<<<<<
  10456. *
  10457. * if flags & PyBUF_STRIDES:
  10458. */
  10459. /*else*/ {
  10460. __pyx_v_info->shape = NULL;
  10461. }
  10462. __pyx_L6:;
  10463. /* "View.MemoryView":527
  10464. * info.shape = NULL
  10465. *
  10466. * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
  10467. * info.strides = self.view.strides
  10468. * else:
  10469. */
  10470. __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
  10471. if (__pyx_t_1) {
  10472. /* "View.MemoryView":528
  10473. *
  10474. * if flags & PyBUF_STRIDES:
  10475. * info.strides = self.view.strides # <<<<<<<<<<<<<<
  10476. * else:
  10477. * info.strides = NULL
  10478. */
  10479. __pyx_t_4 = __pyx_v_self->view.strides;
  10480. __pyx_v_info->strides = __pyx_t_4;
  10481. /* "View.MemoryView":527
  10482. * info.shape = NULL
  10483. *
  10484. * if flags & PyBUF_STRIDES: # <<<<<<<<<<<<<<
  10485. * info.strides = self.view.strides
  10486. * else:
  10487. */
  10488. goto __pyx_L7;
  10489. }
  10490. /* "View.MemoryView":530
  10491. * info.strides = self.view.strides
  10492. * else:
  10493. * info.strides = NULL # <<<<<<<<<<<<<<
  10494. *
  10495. * if flags & PyBUF_INDIRECT:
  10496. */
  10497. /*else*/ {
  10498. __pyx_v_info->strides = NULL;
  10499. }
  10500. __pyx_L7:;
  10501. /* "View.MemoryView":532
  10502. * info.strides = NULL
  10503. *
  10504. * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
  10505. * info.suboffsets = self.view.suboffsets
  10506. * else:
  10507. */
  10508. __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
  10509. if (__pyx_t_1) {
  10510. /* "View.MemoryView":533
  10511. *
  10512. * if flags & PyBUF_INDIRECT:
  10513. * info.suboffsets = self.view.suboffsets # <<<<<<<<<<<<<<
  10514. * else:
  10515. * info.suboffsets = NULL
  10516. */
  10517. __pyx_t_4 = __pyx_v_self->view.suboffsets;
  10518. __pyx_v_info->suboffsets = __pyx_t_4;
  10519. /* "View.MemoryView":532
  10520. * info.strides = NULL
  10521. *
  10522. * if flags & PyBUF_INDIRECT: # <<<<<<<<<<<<<<
  10523. * info.suboffsets = self.view.suboffsets
  10524. * else:
  10525. */
  10526. goto __pyx_L8;
  10527. }
  10528. /* "View.MemoryView":535
  10529. * info.suboffsets = self.view.suboffsets
  10530. * else:
  10531. * info.suboffsets = NULL # <<<<<<<<<<<<<<
  10532. *
  10533. * if flags & PyBUF_FORMAT:
  10534. */
  10535. /*else*/ {
  10536. __pyx_v_info->suboffsets = NULL;
  10537. }
  10538. __pyx_L8:;
  10539. /* "View.MemoryView":537
  10540. * info.suboffsets = NULL
  10541. *
  10542. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  10543. * info.format = self.view.format
  10544. * else:
  10545. */
  10546. __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
  10547. if (__pyx_t_1) {
  10548. /* "View.MemoryView":538
  10549. *
  10550. * if flags & PyBUF_FORMAT:
  10551. * info.format = self.view.format # <<<<<<<<<<<<<<
  10552. * else:
  10553. * info.format = NULL
  10554. */
  10555. __pyx_t_5 = __pyx_v_self->view.format;
  10556. __pyx_v_info->format = __pyx_t_5;
  10557. /* "View.MemoryView":537
  10558. * info.suboffsets = NULL
  10559. *
  10560. * if flags & PyBUF_FORMAT: # <<<<<<<<<<<<<<
  10561. * info.format = self.view.format
  10562. * else:
  10563. */
  10564. goto __pyx_L9;
  10565. }
  10566. /* "View.MemoryView":540
  10567. * info.format = self.view.format
  10568. * else:
  10569. * info.format = NULL # <<<<<<<<<<<<<<
  10570. *
  10571. * info.buf = self.view.buf
  10572. */
  10573. /*else*/ {
  10574. __pyx_v_info->format = NULL;
  10575. }
  10576. __pyx_L9:;
  10577. /* "View.MemoryView":542
  10578. * info.format = NULL
  10579. *
  10580. * info.buf = self.view.buf # <<<<<<<<<<<<<<
  10581. * info.ndim = self.view.ndim
  10582. * info.itemsize = self.view.itemsize
  10583. */
  10584. __pyx_t_6 = __pyx_v_self->view.buf;
  10585. __pyx_v_info->buf = __pyx_t_6;
  10586. /* "View.MemoryView":543
  10587. *
  10588. * info.buf = self.view.buf
  10589. * info.ndim = self.view.ndim # <<<<<<<<<<<<<<
  10590. * info.itemsize = self.view.itemsize
  10591. * info.len = self.view.len
  10592. */
  10593. __pyx_t_7 = __pyx_v_self->view.ndim;
  10594. __pyx_v_info->ndim = __pyx_t_7;
  10595. /* "View.MemoryView":544
  10596. * info.buf = self.view.buf
  10597. * info.ndim = self.view.ndim
  10598. * info.itemsize = self.view.itemsize # <<<<<<<<<<<<<<
  10599. * info.len = self.view.len
  10600. * info.readonly = self.view.readonly
  10601. */
  10602. __pyx_t_8 = __pyx_v_self->view.itemsize;
  10603. __pyx_v_info->itemsize = __pyx_t_8;
  10604. /* "View.MemoryView":545
  10605. * info.ndim = self.view.ndim
  10606. * info.itemsize = self.view.itemsize
  10607. * info.len = self.view.len # <<<<<<<<<<<<<<
  10608. * info.readonly = self.view.readonly
  10609. * info.obj = self
  10610. */
  10611. __pyx_t_8 = __pyx_v_self->view.len;
  10612. __pyx_v_info->len = __pyx_t_8;
  10613. /* "View.MemoryView":546
  10614. * info.itemsize = self.view.itemsize
  10615. * info.len = self.view.len
  10616. * info.readonly = self.view.readonly # <<<<<<<<<<<<<<
  10617. * info.obj = self
  10618. *
  10619. */
  10620. __pyx_t_1 = __pyx_v_self->view.readonly;
  10621. __pyx_v_info->readonly = __pyx_t_1;
  10622. /* "View.MemoryView":547
  10623. * info.len = self.view.len
  10624. * info.readonly = self.view.readonly
  10625. * info.obj = self # <<<<<<<<<<<<<<
  10626. *
  10627. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
  10628. */
  10629. __Pyx_INCREF(((PyObject *)__pyx_v_self));
  10630. __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  10631. __Pyx_GOTREF(__pyx_v_info->obj);
  10632. __Pyx_DECREF(__pyx_v_info->obj);
  10633. __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
  10634. /* "View.MemoryView":518
  10635. *
  10636. * @cname('getbuffer')
  10637. * def __getbuffer__(self, Py_buffer *info, int flags): # <<<<<<<<<<<<<<
  10638. * if flags & PyBUF_WRITABLE and self.view.readonly:
  10639. * raise ValueError("Cannot create writable memory view from read-only memoryview")
  10640. */
  10641. /* function exit code */
  10642. __pyx_r = 0;
  10643. goto __pyx_L0;
  10644. __pyx_L1_error:;
  10645. __Pyx_XDECREF(__pyx_t_3);
  10646. __Pyx_AddTraceback("View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10647. __pyx_r = -1;
  10648. if (__pyx_v_info->obj != NULL) {
  10649. __Pyx_GOTREF(__pyx_v_info->obj);
  10650. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  10651. }
  10652. goto __pyx_L2;
  10653. __pyx_L0:;
  10654. if (__pyx_v_info->obj == Py_None) {
  10655. __Pyx_GOTREF(__pyx_v_info->obj);
  10656. __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
  10657. }
  10658. __pyx_L2:;
  10659. __Pyx_RefNannyFinishContext();
  10660. return __pyx_r;
  10661. }
  10662. /* "View.MemoryView":553
  10663. *
  10664. * @property
  10665. * def T(self): # <<<<<<<<<<<<<<
  10666. * cdef _memoryviewslice result = memoryview_copy(self)
  10667. * transpose_memslice(&result.from_slice)
  10668. */
  10669. /* Python wrapper */
  10670. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self); /*proto*/
  10671. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
  10672. PyObject *__pyx_r = 0;
  10673. __Pyx_RefNannyDeclarations
  10674. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  10675. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  10676. /* function exit code */
  10677. __Pyx_RefNannyFinishContext();
  10678. return __pyx_r;
  10679. }
  10680. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  10681. struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  10682. PyObject *__pyx_r = NULL;
  10683. __Pyx_RefNannyDeclarations
  10684. PyObject *__pyx_t_1 = NULL;
  10685. int __pyx_t_2;
  10686. __Pyx_RefNannySetupContext("__get__", 0);
  10687. /* "View.MemoryView":554
  10688. * @property
  10689. * def T(self):
  10690. * cdef _memoryviewslice result = memoryview_copy(self) # <<<<<<<<<<<<<<
  10691. * transpose_memslice(&result.from_slice)
  10692. * return result
  10693. */
  10694. __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 554, __pyx_L1_error)
  10695. __Pyx_GOTREF(__pyx_t_1);
  10696. if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 554, __pyx_L1_error)
  10697. __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_1);
  10698. __pyx_t_1 = 0;
  10699. /* "View.MemoryView":555
  10700. * def T(self):
  10701. * cdef _memoryviewslice result = memoryview_copy(self)
  10702. * transpose_memslice(&result.from_slice) # <<<<<<<<<<<<<<
  10703. * return result
  10704. *
  10705. */
  10706. __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice)); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 555, __pyx_L1_error)
  10707. /* "View.MemoryView":556
  10708. * cdef _memoryviewslice result = memoryview_copy(self)
  10709. * transpose_memslice(&result.from_slice)
  10710. * return result # <<<<<<<<<<<<<<
  10711. *
  10712. * @property
  10713. */
  10714. __Pyx_XDECREF(__pyx_r);
  10715. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  10716. __pyx_r = ((PyObject *)__pyx_v_result);
  10717. goto __pyx_L0;
  10718. /* "View.MemoryView":553
  10719. *
  10720. * @property
  10721. * def T(self): # <<<<<<<<<<<<<<
  10722. * cdef _memoryviewslice result = memoryview_copy(self)
  10723. * transpose_memslice(&result.from_slice)
  10724. */
  10725. /* function exit code */
  10726. __pyx_L1_error:;
  10727. __Pyx_XDECREF(__pyx_t_1);
  10728. __Pyx_AddTraceback("View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10729. __pyx_r = NULL;
  10730. __pyx_L0:;
  10731. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  10732. __Pyx_XGIVEREF(__pyx_r);
  10733. __Pyx_RefNannyFinishContext();
  10734. return __pyx_r;
  10735. }
  10736. /* "View.MemoryView":559
  10737. *
  10738. * @property
  10739. * def base(self): # <<<<<<<<<<<<<<
  10740. * return self.obj
  10741. *
  10742. */
  10743. /* Python wrapper */
  10744. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
  10745. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
  10746. PyObject *__pyx_r = 0;
  10747. __Pyx_RefNannyDeclarations
  10748. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  10749. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  10750. /* function exit code */
  10751. __Pyx_RefNannyFinishContext();
  10752. return __pyx_r;
  10753. }
  10754. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  10755. PyObject *__pyx_r = NULL;
  10756. __Pyx_RefNannyDeclarations
  10757. __Pyx_RefNannySetupContext("__get__", 0);
  10758. /* "View.MemoryView":560
  10759. * @property
  10760. * def base(self):
  10761. * return self.obj # <<<<<<<<<<<<<<
  10762. *
  10763. * @property
  10764. */
  10765. __Pyx_XDECREF(__pyx_r);
  10766. __Pyx_INCREF(__pyx_v_self->obj);
  10767. __pyx_r = __pyx_v_self->obj;
  10768. goto __pyx_L0;
  10769. /* "View.MemoryView":559
  10770. *
  10771. * @property
  10772. * def base(self): # <<<<<<<<<<<<<<
  10773. * return self.obj
  10774. *
  10775. */
  10776. /* function exit code */
  10777. __pyx_L0:;
  10778. __Pyx_XGIVEREF(__pyx_r);
  10779. __Pyx_RefNannyFinishContext();
  10780. return __pyx_r;
  10781. }
  10782. /* "View.MemoryView":563
  10783. *
  10784. * @property
  10785. * def shape(self): # <<<<<<<<<<<<<<
  10786. * return tuple([length for length in self.view.shape[:self.view.ndim]])
  10787. *
  10788. */
  10789. /* Python wrapper */
  10790. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self); /*proto*/
  10791. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
  10792. PyObject *__pyx_r = 0;
  10793. __Pyx_RefNannyDeclarations
  10794. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  10795. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  10796. /* function exit code */
  10797. __Pyx_RefNannyFinishContext();
  10798. return __pyx_r;
  10799. }
  10800. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  10801. Py_ssize_t __pyx_v_length;
  10802. PyObject *__pyx_r = NULL;
  10803. __Pyx_RefNannyDeclarations
  10804. PyObject *__pyx_t_1 = NULL;
  10805. Py_ssize_t *__pyx_t_2;
  10806. Py_ssize_t *__pyx_t_3;
  10807. Py_ssize_t *__pyx_t_4;
  10808. PyObject *__pyx_t_5 = NULL;
  10809. __Pyx_RefNannySetupContext("__get__", 0);
  10810. /* "View.MemoryView":564
  10811. * @property
  10812. * def shape(self):
  10813. * return tuple([length for length in self.view.shape[:self.view.ndim]]) # <<<<<<<<<<<<<<
  10814. *
  10815. * @property
  10816. */
  10817. __Pyx_XDECREF(__pyx_r);
  10818. __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 564, __pyx_L1_error)
  10819. __Pyx_GOTREF(__pyx_t_1);
  10820. __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  10821. for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
  10822. __pyx_t_2 = __pyx_t_4;
  10823. __pyx_v_length = (__pyx_t_2[0]);
  10824. __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
  10825. __Pyx_GOTREF(__pyx_t_5);
  10826. if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 564, __pyx_L1_error)
  10827. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  10828. }
  10829. __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 564, __pyx_L1_error)
  10830. __Pyx_GOTREF(__pyx_t_5);
  10831. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  10832. __pyx_r = __pyx_t_5;
  10833. __pyx_t_5 = 0;
  10834. goto __pyx_L0;
  10835. /* "View.MemoryView":563
  10836. *
  10837. * @property
  10838. * def shape(self): # <<<<<<<<<<<<<<
  10839. * return tuple([length for length in self.view.shape[:self.view.ndim]])
  10840. *
  10841. */
  10842. /* function exit code */
  10843. __pyx_L1_error:;
  10844. __Pyx_XDECREF(__pyx_t_1);
  10845. __Pyx_XDECREF(__pyx_t_5);
  10846. __Pyx_AddTraceback("View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10847. __pyx_r = NULL;
  10848. __pyx_L0:;
  10849. __Pyx_XGIVEREF(__pyx_r);
  10850. __Pyx_RefNannyFinishContext();
  10851. return __pyx_r;
  10852. }
  10853. /* "View.MemoryView":567
  10854. *
  10855. * @property
  10856. * def strides(self): # <<<<<<<<<<<<<<
  10857. * if self.view.strides == NULL:
  10858. *
  10859. */
  10860. /* Python wrapper */
  10861. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self); /*proto*/
  10862. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
  10863. PyObject *__pyx_r = 0;
  10864. __Pyx_RefNannyDeclarations
  10865. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  10866. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  10867. /* function exit code */
  10868. __Pyx_RefNannyFinishContext();
  10869. return __pyx_r;
  10870. }
  10871. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  10872. Py_ssize_t __pyx_v_stride;
  10873. PyObject *__pyx_r = NULL;
  10874. __Pyx_RefNannyDeclarations
  10875. int __pyx_t_1;
  10876. PyObject *__pyx_t_2 = NULL;
  10877. Py_ssize_t *__pyx_t_3;
  10878. Py_ssize_t *__pyx_t_4;
  10879. Py_ssize_t *__pyx_t_5;
  10880. PyObject *__pyx_t_6 = NULL;
  10881. __Pyx_RefNannySetupContext("__get__", 0);
  10882. /* "View.MemoryView":568
  10883. * @property
  10884. * def strides(self):
  10885. * if self.view.strides == NULL: # <<<<<<<<<<<<<<
  10886. *
  10887. * raise ValueError("Buffer view does not expose strides")
  10888. */
  10889. __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
  10890. if (unlikely(__pyx_t_1)) {
  10891. /* "View.MemoryView":570
  10892. * if self.view.strides == NULL:
  10893. *
  10894. * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
  10895. *
  10896. * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
  10897. */
  10898. __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 570, __pyx_L1_error)
  10899. __Pyx_GOTREF(__pyx_t_2);
  10900. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  10901. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10902. __PYX_ERR(2, 570, __pyx_L1_error)
  10903. /* "View.MemoryView":568
  10904. * @property
  10905. * def strides(self):
  10906. * if self.view.strides == NULL: # <<<<<<<<<<<<<<
  10907. *
  10908. * raise ValueError("Buffer view does not expose strides")
  10909. */
  10910. }
  10911. /* "View.MemoryView":572
  10912. * raise ValueError("Buffer view does not expose strides")
  10913. *
  10914. * return tuple([stride for stride in self.view.strides[:self.view.ndim]]) # <<<<<<<<<<<<<<
  10915. *
  10916. * @property
  10917. */
  10918. __Pyx_XDECREF(__pyx_r);
  10919. __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
  10920. __Pyx_GOTREF(__pyx_t_2);
  10921. __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
  10922. for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
  10923. __pyx_t_3 = __pyx_t_5;
  10924. __pyx_v_stride = (__pyx_t_3[0]);
  10925. __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
  10926. __Pyx_GOTREF(__pyx_t_6);
  10927. if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 572, __pyx_L1_error)
  10928. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  10929. }
  10930. __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2)); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 572, __pyx_L1_error)
  10931. __Pyx_GOTREF(__pyx_t_6);
  10932. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  10933. __pyx_r = __pyx_t_6;
  10934. __pyx_t_6 = 0;
  10935. goto __pyx_L0;
  10936. /* "View.MemoryView":567
  10937. *
  10938. * @property
  10939. * def strides(self): # <<<<<<<<<<<<<<
  10940. * if self.view.strides == NULL:
  10941. *
  10942. */
  10943. /* function exit code */
  10944. __pyx_L1_error:;
  10945. __Pyx_XDECREF(__pyx_t_2);
  10946. __Pyx_XDECREF(__pyx_t_6);
  10947. __Pyx_AddTraceback("View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  10948. __pyx_r = NULL;
  10949. __pyx_L0:;
  10950. __Pyx_XGIVEREF(__pyx_r);
  10951. __Pyx_RefNannyFinishContext();
  10952. return __pyx_r;
  10953. }
  10954. /* "View.MemoryView":575
  10955. *
  10956. * @property
  10957. * def suboffsets(self): # <<<<<<<<<<<<<<
  10958. * if self.view.suboffsets == NULL:
  10959. * return (-1,) * self.view.ndim
  10960. */
  10961. /* Python wrapper */
  10962. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self); /*proto*/
  10963. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
  10964. PyObject *__pyx_r = 0;
  10965. __Pyx_RefNannyDeclarations
  10966. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  10967. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  10968. /* function exit code */
  10969. __Pyx_RefNannyFinishContext();
  10970. return __pyx_r;
  10971. }
  10972. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  10973. Py_ssize_t __pyx_v_suboffset;
  10974. PyObject *__pyx_r = NULL;
  10975. __Pyx_RefNannyDeclarations
  10976. int __pyx_t_1;
  10977. PyObject *__pyx_t_2 = NULL;
  10978. PyObject *__pyx_t_3 = NULL;
  10979. Py_ssize_t *__pyx_t_4;
  10980. Py_ssize_t *__pyx_t_5;
  10981. Py_ssize_t *__pyx_t_6;
  10982. __Pyx_RefNannySetupContext("__get__", 0);
  10983. /* "View.MemoryView":576
  10984. * @property
  10985. * def suboffsets(self):
  10986. * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
  10987. * return (-1,) * self.view.ndim
  10988. *
  10989. */
  10990. __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
  10991. if (__pyx_t_1) {
  10992. /* "View.MemoryView":577
  10993. * def suboffsets(self):
  10994. * if self.view.suboffsets == NULL:
  10995. * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
  10996. *
  10997. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
  10998. */
  10999. __Pyx_XDECREF(__pyx_r);
  11000. __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 577, __pyx_L1_error)
  11001. __Pyx_GOTREF(__pyx_t_2);
  11002. __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__21, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 577, __pyx_L1_error)
  11003. __Pyx_GOTREF(__pyx_t_3);
  11004. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11005. __pyx_r = __pyx_t_3;
  11006. __pyx_t_3 = 0;
  11007. goto __pyx_L0;
  11008. /* "View.MemoryView":576
  11009. * @property
  11010. * def suboffsets(self):
  11011. * if self.view.suboffsets == NULL: # <<<<<<<<<<<<<<
  11012. * return (-1,) * self.view.ndim
  11013. *
  11014. */
  11015. }
  11016. /* "View.MemoryView":579
  11017. * return (-1,) * self.view.ndim
  11018. *
  11019. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]]) # <<<<<<<<<<<<<<
  11020. *
  11021. * @property
  11022. */
  11023. __Pyx_XDECREF(__pyx_r);
  11024. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
  11025. __Pyx_GOTREF(__pyx_t_3);
  11026. __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
  11027. for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
  11028. __pyx_t_4 = __pyx_t_6;
  11029. __pyx_v_suboffset = (__pyx_t_4[0]);
  11030. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
  11031. __Pyx_GOTREF(__pyx_t_2);
  11032. if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 579, __pyx_L1_error)
  11033. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11034. }
  11035. __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
  11036. __Pyx_GOTREF(__pyx_t_2);
  11037. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11038. __pyx_r = __pyx_t_2;
  11039. __pyx_t_2 = 0;
  11040. goto __pyx_L0;
  11041. /* "View.MemoryView":575
  11042. *
  11043. * @property
  11044. * def suboffsets(self): # <<<<<<<<<<<<<<
  11045. * if self.view.suboffsets == NULL:
  11046. * return (-1,) * self.view.ndim
  11047. */
  11048. /* function exit code */
  11049. __pyx_L1_error:;
  11050. __Pyx_XDECREF(__pyx_t_2);
  11051. __Pyx_XDECREF(__pyx_t_3);
  11052. __Pyx_AddTraceback("View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11053. __pyx_r = NULL;
  11054. __pyx_L0:;
  11055. __Pyx_XGIVEREF(__pyx_r);
  11056. __Pyx_RefNannyFinishContext();
  11057. return __pyx_r;
  11058. }
  11059. /* "View.MemoryView":582
  11060. *
  11061. * @property
  11062. * def ndim(self): # <<<<<<<<<<<<<<
  11063. * return self.view.ndim
  11064. *
  11065. */
  11066. /* Python wrapper */
  11067. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self); /*proto*/
  11068. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
  11069. PyObject *__pyx_r = 0;
  11070. __Pyx_RefNannyDeclarations
  11071. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  11072. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11073. /* function exit code */
  11074. __Pyx_RefNannyFinishContext();
  11075. return __pyx_r;
  11076. }
  11077. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  11078. PyObject *__pyx_r = NULL;
  11079. __Pyx_RefNannyDeclarations
  11080. PyObject *__pyx_t_1 = NULL;
  11081. __Pyx_RefNannySetupContext("__get__", 0);
  11082. /* "View.MemoryView":583
  11083. * @property
  11084. * def ndim(self):
  11085. * return self.view.ndim # <<<<<<<<<<<<<<
  11086. *
  11087. * @property
  11088. */
  11089. __Pyx_XDECREF(__pyx_r);
  11090. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 583, __pyx_L1_error)
  11091. __Pyx_GOTREF(__pyx_t_1);
  11092. __pyx_r = __pyx_t_1;
  11093. __pyx_t_1 = 0;
  11094. goto __pyx_L0;
  11095. /* "View.MemoryView":582
  11096. *
  11097. * @property
  11098. * def ndim(self): # <<<<<<<<<<<<<<
  11099. * return self.view.ndim
  11100. *
  11101. */
  11102. /* function exit code */
  11103. __pyx_L1_error:;
  11104. __Pyx_XDECREF(__pyx_t_1);
  11105. __Pyx_AddTraceback("View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11106. __pyx_r = NULL;
  11107. __pyx_L0:;
  11108. __Pyx_XGIVEREF(__pyx_r);
  11109. __Pyx_RefNannyFinishContext();
  11110. return __pyx_r;
  11111. }
  11112. /* "View.MemoryView":586
  11113. *
  11114. * @property
  11115. * def itemsize(self): # <<<<<<<<<<<<<<
  11116. * return self.view.itemsize
  11117. *
  11118. */
  11119. /* Python wrapper */
  11120. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self); /*proto*/
  11121. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
  11122. PyObject *__pyx_r = 0;
  11123. __Pyx_RefNannyDeclarations
  11124. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  11125. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11126. /* function exit code */
  11127. __Pyx_RefNannyFinishContext();
  11128. return __pyx_r;
  11129. }
  11130. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  11131. PyObject *__pyx_r = NULL;
  11132. __Pyx_RefNannyDeclarations
  11133. PyObject *__pyx_t_1 = NULL;
  11134. __Pyx_RefNannySetupContext("__get__", 0);
  11135. /* "View.MemoryView":587
  11136. * @property
  11137. * def itemsize(self):
  11138. * return self.view.itemsize # <<<<<<<<<<<<<<
  11139. *
  11140. * @property
  11141. */
  11142. __Pyx_XDECREF(__pyx_r);
  11143. __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 587, __pyx_L1_error)
  11144. __Pyx_GOTREF(__pyx_t_1);
  11145. __pyx_r = __pyx_t_1;
  11146. __pyx_t_1 = 0;
  11147. goto __pyx_L0;
  11148. /* "View.MemoryView":586
  11149. *
  11150. * @property
  11151. * def itemsize(self): # <<<<<<<<<<<<<<
  11152. * return self.view.itemsize
  11153. *
  11154. */
  11155. /* function exit code */
  11156. __pyx_L1_error:;
  11157. __Pyx_XDECREF(__pyx_t_1);
  11158. __Pyx_AddTraceback("View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11159. __pyx_r = NULL;
  11160. __pyx_L0:;
  11161. __Pyx_XGIVEREF(__pyx_r);
  11162. __Pyx_RefNannyFinishContext();
  11163. return __pyx_r;
  11164. }
  11165. /* "View.MemoryView":590
  11166. *
  11167. * @property
  11168. * def nbytes(self): # <<<<<<<<<<<<<<
  11169. * return self.size * self.view.itemsize
  11170. *
  11171. */
  11172. /* Python wrapper */
  11173. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self); /*proto*/
  11174. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
  11175. PyObject *__pyx_r = 0;
  11176. __Pyx_RefNannyDeclarations
  11177. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  11178. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11179. /* function exit code */
  11180. __Pyx_RefNannyFinishContext();
  11181. return __pyx_r;
  11182. }
  11183. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  11184. PyObject *__pyx_r = NULL;
  11185. __Pyx_RefNannyDeclarations
  11186. PyObject *__pyx_t_1 = NULL;
  11187. PyObject *__pyx_t_2 = NULL;
  11188. PyObject *__pyx_t_3 = NULL;
  11189. __Pyx_RefNannySetupContext("__get__", 0);
  11190. /* "View.MemoryView":591
  11191. * @property
  11192. * def nbytes(self):
  11193. * return self.size * self.view.itemsize # <<<<<<<<<<<<<<
  11194. *
  11195. * @property
  11196. */
  11197. __Pyx_XDECREF(__pyx_r);
  11198. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 591, __pyx_L1_error)
  11199. __Pyx_GOTREF(__pyx_t_1);
  11200. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 591, __pyx_L1_error)
  11201. __Pyx_GOTREF(__pyx_t_2);
  11202. __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 591, __pyx_L1_error)
  11203. __Pyx_GOTREF(__pyx_t_3);
  11204. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11205. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11206. __pyx_r = __pyx_t_3;
  11207. __pyx_t_3 = 0;
  11208. goto __pyx_L0;
  11209. /* "View.MemoryView":590
  11210. *
  11211. * @property
  11212. * def nbytes(self): # <<<<<<<<<<<<<<
  11213. * return self.size * self.view.itemsize
  11214. *
  11215. */
  11216. /* function exit code */
  11217. __pyx_L1_error:;
  11218. __Pyx_XDECREF(__pyx_t_1);
  11219. __Pyx_XDECREF(__pyx_t_2);
  11220. __Pyx_XDECREF(__pyx_t_3);
  11221. __Pyx_AddTraceback("View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11222. __pyx_r = NULL;
  11223. __pyx_L0:;
  11224. __Pyx_XGIVEREF(__pyx_r);
  11225. __Pyx_RefNannyFinishContext();
  11226. return __pyx_r;
  11227. }
  11228. /* "View.MemoryView":594
  11229. *
  11230. * @property
  11231. * def size(self): # <<<<<<<<<<<<<<
  11232. * if self._size is None:
  11233. * result = 1
  11234. */
  11235. /* Python wrapper */
  11236. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self); /*proto*/
  11237. static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
  11238. PyObject *__pyx_r = 0;
  11239. __Pyx_RefNannyDeclarations
  11240. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  11241. __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11242. /* function exit code */
  11243. __Pyx_RefNannyFinishContext();
  11244. return __pyx_r;
  11245. }
  11246. static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struct __pyx_memoryview_obj *__pyx_v_self) {
  11247. PyObject *__pyx_v_result = NULL;
  11248. PyObject *__pyx_v_length = NULL;
  11249. PyObject *__pyx_r = NULL;
  11250. __Pyx_RefNannyDeclarations
  11251. int __pyx_t_1;
  11252. int __pyx_t_2;
  11253. Py_ssize_t *__pyx_t_3;
  11254. Py_ssize_t *__pyx_t_4;
  11255. Py_ssize_t *__pyx_t_5;
  11256. PyObject *__pyx_t_6 = NULL;
  11257. __Pyx_RefNannySetupContext("__get__", 0);
  11258. /* "View.MemoryView":595
  11259. * @property
  11260. * def size(self):
  11261. * if self._size is None: # <<<<<<<<<<<<<<
  11262. * result = 1
  11263. *
  11264. */
  11265. __pyx_t_1 = (__pyx_v_self->_size == Py_None);
  11266. __pyx_t_2 = (__pyx_t_1 != 0);
  11267. if (__pyx_t_2) {
  11268. /* "View.MemoryView":596
  11269. * def size(self):
  11270. * if self._size is None:
  11271. * result = 1 # <<<<<<<<<<<<<<
  11272. *
  11273. * for length in self.view.shape[:self.view.ndim]:
  11274. */
  11275. __Pyx_INCREF(__pyx_int_1);
  11276. __pyx_v_result = __pyx_int_1;
  11277. /* "View.MemoryView":598
  11278. * result = 1
  11279. *
  11280. * for length in self.view.shape[:self.view.ndim]: # <<<<<<<<<<<<<<
  11281. * result *= length
  11282. *
  11283. */
  11284. __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
  11285. for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
  11286. __pyx_t_3 = __pyx_t_5;
  11287. __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0])); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 598, __pyx_L1_error)
  11288. __Pyx_GOTREF(__pyx_t_6);
  11289. __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
  11290. __pyx_t_6 = 0;
  11291. /* "View.MemoryView":599
  11292. *
  11293. * for length in self.view.shape[:self.view.ndim]:
  11294. * result *= length # <<<<<<<<<<<<<<
  11295. *
  11296. * self._size = result
  11297. */
  11298. __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 599, __pyx_L1_error)
  11299. __Pyx_GOTREF(__pyx_t_6);
  11300. __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
  11301. __pyx_t_6 = 0;
  11302. }
  11303. /* "View.MemoryView":601
  11304. * result *= length
  11305. *
  11306. * self._size = result # <<<<<<<<<<<<<<
  11307. *
  11308. * return self._size
  11309. */
  11310. __Pyx_INCREF(__pyx_v_result);
  11311. __Pyx_GIVEREF(__pyx_v_result);
  11312. __Pyx_GOTREF(__pyx_v_self->_size);
  11313. __Pyx_DECREF(__pyx_v_self->_size);
  11314. __pyx_v_self->_size = __pyx_v_result;
  11315. /* "View.MemoryView":595
  11316. * @property
  11317. * def size(self):
  11318. * if self._size is None: # <<<<<<<<<<<<<<
  11319. * result = 1
  11320. *
  11321. */
  11322. }
  11323. /* "View.MemoryView":603
  11324. * self._size = result
  11325. *
  11326. * return self._size # <<<<<<<<<<<<<<
  11327. *
  11328. * def __len__(self):
  11329. */
  11330. __Pyx_XDECREF(__pyx_r);
  11331. __Pyx_INCREF(__pyx_v_self->_size);
  11332. __pyx_r = __pyx_v_self->_size;
  11333. goto __pyx_L0;
  11334. /* "View.MemoryView":594
  11335. *
  11336. * @property
  11337. * def size(self): # <<<<<<<<<<<<<<
  11338. * if self._size is None:
  11339. * result = 1
  11340. */
  11341. /* function exit code */
  11342. __pyx_L1_error:;
  11343. __Pyx_XDECREF(__pyx_t_6);
  11344. __Pyx_AddTraceback("View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11345. __pyx_r = NULL;
  11346. __pyx_L0:;
  11347. __Pyx_XDECREF(__pyx_v_result);
  11348. __Pyx_XDECREF(__pyx_v_length);
  11349. __Pyx_XGIVEREF(__pyx_r);
  11350. __Pyx_RefNannyFinishContext();
  11351. return __pyx_r;
  11352. }
  11353. /* "View.MemoryView":605
  11354. * return self._size
  11355. *
  11356. * def __len__(self): # <<<<<<<<<<<<<<
  11357. * if self.view.ndim >= 1:
  11358. * return self.view.shape[0]
  11359. */
  11360. /* Python wrapper */
  11361. static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self); /*proto*/
  11362. static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
  11363. Py_ssize_t __pyx_r;
  11364. __Pyx_RefNannyDeclarations
  11365. __Pyx_RefNannySetupContext("__len__ (wrapper)", 0);
  11366. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11367. /* function exit code */
  11368. __Pyx_RefNannyFinishContext();
  11369. return __pyx_r;
  11370. }
  11371. static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(struct __pyx_memoryview_obj *__pyx_v_self) {
  11372. Py_ssize_t __pyx_r;
  11373. __Pyx_RefNannyDeclarations
  11374. int __pyx_t_1;
  11375. __Pyx_RefNannySetupContext("__len__", 0);
  11376. /* "View.MemoryView":606
  11377. *
  11378. * def __len__(self):
  11379. * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
  11380. * return self.view.shape[0]
  11381. *
  11382. */
  11383. __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
  11384. if (__pyx_t_1) {
  11385. /* "View.MemoryView":607
  11386. * def __len__(self):
  11387. * if self.view.ndim >= 1:
  11388. * return self.view.shape[0] # <<<<<<<<<<<<<<
  11389. *
  11390. * return 0
  11391. */
  11392. __pyx_r = (__pyx_v_self->view.shape[0]);
  11393. goto __pyx_L0;
  11394. /* "View.MemoryView":606
  11395. *
  11396. * def __len__(self):
  11397. * if self.view.ndim >= 1: # <<<<<<<<<<<<<<
  11398. * return self.view.shape[0]
  11399. *
  11400. */
  11401. }
  11402. /* "View.MemoryView":609
  11403. * return self.view.shape[0]
  11404. *
  11405. * return 0 # <<<<<<<<<<<<<<
  11406. *
  11407. * def __repr__(self):
  11408. */
  11409. __pyx_r = 0;
  11410. goto __pyx_L0;
  11411. /* "View.MemoryView":605
  11412. * return self._size
  11413. *
  11414. * def __len__(self): # <<<<<<<<<<<<<<
  11415. * if self.view.ndim >= 1:
  11416. * return self.view.shape[0]
  11417. */
  11418. /* function exit code */
  11419. __pyx_L0:;
  11420. __Pyx_RefNannyFinishContext();
  11421. return __pyx_r;
  11422. }
  11423. /* "View.MemoryView":611
  11424. * return 0
  11425. *
  11426. * def __repr__(self): # <<<<<<<<<<<<<<
  11427. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  11428. * id(self))
  11429. */
  11430. /* Python wrapper */
  11431. static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self); /*proto*/
  11432. static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
  11433. PyObject *__pyx_r = 0;
  11434. __Pyx_RefNannyDeclarations
  11435. __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
  11436. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11437. /* function exit code */
  11438. __Pyx_RefNannyFinishContext();
  11439. return __pyx_r;
  11440. }
  11441. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(struct __pyx_memoryview_obj *__pyx_v_self) {
  11442. PyObject *__pyx_r = NULL;
  11443. __Pyx_RefNannyDeclarations
  11444. PyObject *__pyx_t_1 = NULL;
  11445. PyObject *__pyx_t_2 = NULL;
  11446. PyObject *__pyx_t_3 = NULL;
  11447. __Pyx_RefNannySetupContext("__repr__", 0);
  11448. /* "View.MemoryView":612
  11449. *
  11450. * def __repr__(self):
  11451. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
  11452. * id(self))
  11453. *
  11454. */
  11455. __Pyx_XDECREF(__pyx_r);
  11456. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
  11457. __Pyx_GOTREF(__pyx_t_1);
  11458. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 612, __pyx_L1_error)
  11459. __Pyx_GOTREF(__pyx_t_2);
  11460. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11461. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 612, __pyx_L1_error)
  11462. __Pyx_GOTREF(__pyx_t_1);
  11463. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11464. /* "View.MemoryView":613
  11465. * def __repr__(self):
  11466. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  11467. * id(self)) # <<<<<<<<<<<<<<
  11468. *
  11469. * def __str__(self):
  11470. */
  11471. __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 613, __pyx_L1_error)
  11472. __Pyx_GOTREF(__pyx_t_2);
  11473. /* "View.MemoryView":612
  11474. *
  11475. * def __repr__(self):
  11476. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__, # <<<<<<<<<<<<<<
  11477. * id(self))
  11478. *
  11479. */
  11480. __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 612, __pyx_L1_error)
  11481. __Pyx_GOTREF(__pyx_t_3);
  11482. __Pyx_GIVEREF(__pyx_t_1);
  11483. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
  11484. __Pyx_GIVEREF(__pyx_t_2);
  11485. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
  11486. __pyx_t_1 = 0;
  11487. __pyx_t_2 = 0;
  11488. __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(2, 612, __pyx_L1_error)
  11489. __Pyx_GOTREF(__pyx_t_2);
  11490. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  11491. __pyx_r = __pyx_t_2;
  11492. __pyx_t_2 = 0;
  11493. goto __pyx_L0;
  11494. /* "View.MemoryView":611
  11495. * return 0
  11496. *
  11497. * def __repr__(self): # <<<<<<<<<<<<<<
  11498. * return "<MemoryView of %r at 0x%x>" % (self.base.__class__.__name__,
  11499. * id(self))
  11500. */
  11501. /* function exit code */
  11502. __pyx_L1_error:;
  11503. __Pyx_XDECREF(__pyx_t_1);
  11504. __Pyx_XDECREF(__pyx_t_2);
  11505. __Pyx_XDECREF(__pyx_t_3);
  11506. __Pyx_AddTraceback("View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11507. __pyx_r = NULL;
  11508. __pyx_L0:;
  11509. __Pyx_XGIVEREF(__pyx_r);
  11510. __Pyx_RefNannyFinishContext();
  11511. return __pyx_r;
  11512. }
  11513. /* "View.MemoryView":615
  11514. * id(self))
  11515. *
  11516. * def __str__(self): # <<<<<<<<<<<<<<
  11517. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
  11518. *
  11519. */
  11520. /* Python wrapper */
  11521. static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self); /*proto*/
  11522. static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
  11523. PyObject *__pyx_r = 0;
  11524. __Pyx_RefNannyDeclarations
  11525. __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  11526. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11527. /* function exit code */
  11528. __Pyx_RefNannyFinishContext();
  11529. return __pyx_r;
  11530. }
  11531. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(struct __pyx_memoryview_obj *__pyx_v_self) {
  11532. PyObject *__pyx_r = NULL;
  11533. __Pyx_RefNannyDeclarations
  11534. PyObject *__pyx_t_1 = NULL;
  11535. PyObject *__pyx_t_2 = NULL;
  11536. __Pyx_RefNannySetupContext("__str__", 0);
  11537. /* "View.MemoryView":616
  11538. *
  11539. * def __str__(self):
  11540. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,) # <<<<<<<<<<<<<<
  11541. *
  11542. *
  11543. */
  11544. __Pyx_XDECREF(__pyx_r);
  11545. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
  11546. __Pyx_GOTREF(__pyx_t_1);
  11547. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
  11548. __Pyx_GOTREF(__pyx_t_2);
  11549. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11550. __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
  11551. __Pyx_GOTREF(__pyx_t_1);
  11552. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11553. __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 616, __pyx_L1_error)
  11554. __Pyx_GOTREF(__pyx_t_2);
  11555. __Pyx_GIVEREF(__pyx_t_1);
  11556. PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
  11557. __pyx_t_1 = 0;
  11558. __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 616, __pyx_L1_error)
  11559. __Pyx_GOTREF(__pyx_t_1);
  11560. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  11561. __pyx_r = __pyx_t_1;
  11562. __pyx_t_1 = 0;
  11563. goto __pyx_L0;
  11564. /* "View.MemoryView":615
  11565. * id(self))
  11566. *
  11567. * def __str__(self): # <<<<<<<<<<<<<<
  11568. * return "<MemoryView of %r object>" % (self.base.__class__.__name__,)
  11569. *
  11570. */
  11571. /* function exit code */
  11572. __pyx_L1_error:;
  11573. __Pyx_XDECREF(__pyx_t_1);
  11574. __Pyx_XDECREF(__pyx_t_2);
  11575. __Pyx_AddTraceback("View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11576. __pyx_r = NULL;
  11577. __pyx_L0:;
  11578. __Pyx_XGIVEREF(__pyx_r);
  11579. __Pyx_RefNannyFinishContext();
  11580. return __pyx_r;
  11581. }
  11582. /* "View.MemoryView":619
  11583. *
  11584. *
  11585. * def is_c_contig(self): # <<<<<<<<<<<<<<
  11586. * cdef __Pyx_memviewslice *mslice
  11587. * cdef __Pyx_memviewslice tmp
  11588. */
  11589. /* Python wrapper */
  11590. static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  11591. static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  11592. PyObject *__pyx_r = 0;
  11593. __Pyx_RefNannyDeclarations
  11594. __Pyx_RefNannySetupContext("is_c_contig (wrapper)", 0);
  11595. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11596. /* function exit code */
  11597. __Pyx_RefNannyFinishContext();
  11598. return __pyx_r;
  11599. }
  11600. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  11601. __Pyx_memviewslice *__pyx_v_mslice;
  11602. __Pyx_memviewslice __pyx_v_tmp;
  11603. PyObject *__pyx_r = NULL;
  11604. __Pyx_RefNannyDeclarations
  11605. __Pyx_memviewslice *__pyx_t_1;
  11606. PyObject *__pyx_t_2 = NULL;
  11607. __Pyx_RefNannySetupContext("is_c_contig", 0);
  11608. /* "View.MemoryView":622
  11609. * cdef __Pyx_memviewslice *mslice
  11610. * cdef __Pyx_memviewslice tmp
  11611. * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
  11612. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  11613. *
  11614. */
  11615. __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(2, 622, __pyx_L1_error)
  11616. __pyx_v_mslice = __pyx_t_1;
  11617. /* "View.MemoryView":623
  11618. * cdef __Pyx_memviewslice tmp
  11619. * mslice = get_slice_from_memview(self, &tmp)
  11620. * return slice_is_contig(mslice[0], 'C', self.view.ndim) # <<<<<<<<<<<<<<
  11621. *
  11622. * def is_f_contig(self):
  11623. */
  11624. __Pyx_XDECREF(__pyx_r);
  11625. __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(2, 623, __pyx_L1_error)
  11626. __Pyx_GOTREF(__pyx_t_2);
  11627. __pyx_r = __pyx_t_2;
  11628. __pyx_t_2 = 0;
  11629. goto __pyx_L0;
  11630. /* "View.MemoryView":619
  11631. *
  11632. *
  11633. * def is_c_contig(self): # <<<<<<<<<<<<<<
  11634. * cdef __Pyx_memviewslice *mslice
  11635. * cdef __Pyx_memviewslice tmp
  11636. */
  11637. /* function exit code */
  11638. __pyx_L1_error:;
  11639. __Pyx_XDECREF(__pyx_t_2);
  11640. __Pyx_AddTraceback("View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11641. __pyx_r = NULL;
  11642. __pyx_L0:;
  11643. __Pyx_XGIVEREF(__pyx_r);
  11644. __Pyx_RefNannyFinishContext();
  11645. return __pyx_r;
  11646. }
  11647. /* "View.MemoryView":625
  11648. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  11649. *
  11650. * def is_f_contig(self): # <<<<<<<<<<<<<<
  11651. * cdef __Pyx_memviewslice *mslice
  11652. * cdef __Pyx_memviewslice tmp
  11653. */
  11654. /* Python wrapper */
  11655. static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  11656. static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  11657. PyObject *__pyx_r = 0;
  11658. __Pyx_RefNannyDeclarations
  11659. __Pyx_RefNannySetupContext("is_f_contig (wrapper)", 0);
  11660. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11661. /* function exit code */
  11662. __Pyx_RefNannyFinishContext();
  11663. return __pyx_r;
  11664. }
  11665. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(struct __pyx_memoryview_obj *__pyx_v_self) {
  11666. __Pyx_memviewslice *__pyx_v_mslice;
  11667. __Pyx_memviewslice __pyx_v_tmp;
  11668. PyObject *__pyx_r = NULL;
  11669. __Pyx_RefNannyDeclarations
  11670. __Pyx_memviewslice *__pyx_t_1;
  11671. PyObject *__pyx_t_2 = NULL;
  11672. __Pyx_RefNannySetupContext("is_f_contig", 0);
  11673. /* "View.MemoryView":628
  11674. * cdef __Pyx_memviewslice *mslice
  11675. * cdef __Pyx_memviewslice tmp
  11676. * mslice = get_slice_from_memview(self, &tmp) # <<<<<<<<<<<<<<
  11677. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  11678. *
  11679. */
  11680. __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(2, 628, __pyx_L1_error)
  11681. __pyx_v_mslice = __pyx_t_1;
  11682. /* "View.MemoryView":629
  11683. * cdef __Pyx_memviewslice tmp
  11684. * mslice = get_slice_from_memview(self, &tmp)
  11685. * return slice_is_contig(mslice[0], 'F', self.view.ndim) # <<<<<<<<<<<<<<
  11686. *
  11687. * def copy(self):
  11688. */
  11689. __Pyx_XDECREF(__pyx_r);
  11690. __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(2, 629, __pyx_L1_error)
  11691. __Pyx_GOTREF(__pyx_t_2);
  11692. __pyx_r = __pyx_t_2;
  11693. __pyx_t_2 = 0;
  11694. goto __pyx_L0;
  11695. /* "View.MemoryView":625
  11696. * return slice_is_contig(mslice[0], 'C', self.view.ndim)
  11697. *
  11698. * def is_f_contig(self): # <<<<<<<<<<<<<<
  11699. * cdef __Pyx_memviewslice *mslice
  11700. * cdef __Pyx_memviewslice tmp
  11701. */
  11702. /* function exit code */
  11703. __pyx_L1_error:;
  11704. __Pyx_XDECREF(__pyx_t_2);
  11705. __Pyx_AddTraceback("View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11706. __pyx_r = NULL;
  11707. __pyx_L0:;
  11708. __Pyx_XGIVEREF(__pyx_r);
  11709. __Pyx_RefNannyFinishContext();
  11710. return __pyx_r;
  11711. }
  11712. /* "View.MemoryView":631
  11713. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  11714. *
  11715. * def copy(self): # <<<<<<<<<<<<<<
  11716. * cdef __Pyx_memviewslice mslice
  11717. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  11718. */
  11719. /* Python wrapper */
  11720. static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  11721. static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  11722. PyObject *__pyx_r = 0;
  11723. __Pyx_RefNannyDeclarations
  11724. __Pyx_RefNannySetupContext("copy (wrapper)", 0);
  11725. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11726. /* function exit code */
  11727. __Pyx_RefNannyFinishContext();
  11728. return __pyx_r;
  11729. }
  11730. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(struct __pyx_memoryview_obj *__pyx_v_self) {
  11731. __Pyx_memviewslice __pyx_v_mslice;
  11732. int __pyx_v_flags;
  11733. PyObject *__pyx_r = NULL;
  11734. __Pyx_RefNannyDeclarations
  11735. __Pyx_memviewslice __pyx_t_1;
  11736. PyObject *__pyx_t_2 = NULL;
  11737. __Pyx_RefNannySetupContext("copy", 0);
  11738. /* "View.MemoryView":633
  11739. * def copy(self):
  11740. * cdef __Pyx_memviewslice mslice
  11741. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS # <<<<<<<<<<<<<<
  11742. *
  11743. * slice_copy(self, &mslice)
  11744. */
  11745. __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
  11746. /* "View.MemoryView":635
  11747. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  11748. *
  11749. * slice_copy(self, &mslice) # <<<<<<<<<<<<<<
  11750. * mslice = slice_copy_contig(&mslice, "c", self.view.ndim,
  11751. * self.view.itemsize,
  11752. */
  11753. __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
  11754. /* "View.MemoryView":636
  11755. *
  11756. * slice_copy(self, &mslice)
  11757. * mslice = slice_copy_contig(&mslice, "c", self.view.ndim, # <<<<<<<<<<<<<<
  11758. * self.view.itemsize,
  11759. * flags|PyBUF_C_CONTIGUOUS,
  11760. */
  11761. __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(2, 636, __pyx_L1_error)
  11762. __pyx_v_mslice = __pyx_t_1;
  11763. /* "View.MemoryView":641
  11764. * self.dtype_is_object)
  11765. *
  11766. * return memoryview_copy_from_slice(self, &mslice) # <<<<<<<<<<<<<<
  11767. *
  11768. * def copy_fortran(self):
  11769. */
  11770. __Pyx_XDECREF(__pyx_r);
  11771. __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 641, __pyx_L1_error)
  11772. __Pyx_GOTREF(__pyx_t_2);
  11773. __pyx_r = __pyx_t_2;
  11774. __pyx_t_2 = 0;
  11775. goto __pyx_L0;
  11776. /* "View.MemoryView":631
  11777. * return slice_is_contig(mslice[0], 'F', self.view.ndim)
  11778. *
  11779. * def copy(self): # <<<<<<<<<<<<<<
  11780. * cdef __Pyx_memviewslice mslice
  11781. * cdef int flags = self.flags & ~PyBUF_F_CONTIGUOUS
  11782. */
  11783. /* function exit code */
  11784. __pyx_L1_error:;
  11785. __Pyx_XDECREF(__pyx_t_2);
  11786. __Pyx_AddTraceback("View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11787. __pyx_r = NULL;
  11788. __pyx_L0:;
  11789. __Pyx_XGIVEREF(__pyx_r);
  11790. __Pyx_RefNannyFinishContext();
  11791. return __pyx_r;
  11792. }
  11793. /* "View.MemoryView":643
  11794. * return memoryview_copy_from_slice(self, &mslice)
  11795. *
  11796. * def copy_fortran(self): # <<<<<<<<<<<<<<
  11797. * cdef __Pyx_memviewslice src, dst
  11798. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  11799. */
  11800. /* Python wrapper */
  11801. static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  11802. static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  11803. PyObject *__pyx_r = 0;
  11804. __Pyx_RefNannyDeclarations
  11805. __Pyx_RefNannySetupContext("copy_fortran (wrapper)", 0);
  11806. __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11807. /* function exit code */
  11808. __Pyx_RefNannyFinishContext();
  11809. return __pyx_r;
  11810. }
  11811. static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(struct __pyx_memoryview_obj *__pyx_v_self) {
  11812. __Pyx_memviewslice __pyx_v_src;
  11813. __Pyx_memviewslice __pyx_v_dst;
  11814. int __pyx_v_flags;
  11815. PyObject *__pyx_r = NULL;
  11816. __Pyx_RefNannyDeclarations
  11817. __Pyx_memviewslice __pyx_t_1;
  11818. PyObject *__pyx_t_2 = NULL;
  11819. __Pyx_RefNannySetupContext("copy_fortran", 0);
  11820. /* "View.MemoryView":645
  11821. * def copy_fortran(self):
  11822. * cdef __Pyx_memviewslice src, dst
  11823. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS # <<<<<<<<<<<<<<
  11824. *
  11825. * slice_copy(self, &src)
  11826. */
  11827. __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
  11828. /* "View.MemoryView":647
  11829. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  11830. *
  11831. * slice_copy(self, &src) # <<<<<<<<<<<<<<
  11832. * dst = slice_copy_contig(&src, "fortran", self.view.ndim,
  11833. * self.view.itemsize,
  11834. */
  11835. __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
  11836. /* "View.MemoryView":648
  11837. *
  11838. * slice_copy(self, &src)
  11839. * dst = slice_copy_contig(&src, "fortran", self.view.ndim, # <<<<<<<<<<<<<<
  11840. * self.view.itemsize,
  11841. * flags|PyBUF_F_CONTIGUOUS,
  11842. */
  11843. __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(2, 648, __pyx_L1_error)
  11844. __pyx_v_dst = __pyx_t_1;
  11845. /* "View.MemoryView":653
  11846. * self.dtype_is_object)
  11847. *
  11848. * return memoryview_copy_from_slice(self, &dst) # <<<<<<<<<<<<<<
  11849. *
  11850. *
  11851. */
  11852. __Pyx_XDECREF(__pyx_r);
  11853. __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst)); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 653, __pyx_L1_error)
  11854. __Pyx_GOTREF(__pyx_t_2);
  11855. __pyx_r = __pyx_t_2;
  11856. __pyx_t_2 = 0;
  11857. goto __pyx_L0;
  11858. /* "View.MemoryView":643
  11859. * return memoryview_copy_from_slice(self, &mslice)
  11860. *
  11861. * def copy_fortran(self): # <<<<<<<<<<<<<<
  11862. * cdef __Pyx_memviewslice src, dst
  11863. * cdef int flags = self.flags & ~PyBUF_C_CONTIGUOUS
  11864. */
  11865. /* function exit code */
  11866. __pyx_L1_error:;
  11867. __Pyx_XDECREF(__pyx_t_2);
  11868. __Pyx_AddTraceback("View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11869. __pyx_r = NULL;
  11870. __pyx_L0:;
  11871. __Pyx_XGIVEREF(__pyx_r);
  11872. __Pyx_RefNannyFinishContext();
  11873. return __pyx_r;
  11874. }
  11875. /* "(tree fragment)":1
  11876. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  11877. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11878. * def __setstate_cython__(self, __pyx_state):
  11879. */
  11880. /* Python wrapper */
  11881. static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  11882. static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  11883. PyObject *__pyx_r = 0;
  11884. __Pyx_RefNannyDeclarations
  11885. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  11886. __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self));
  11887. /* function exit code */
  11888. __Pyx_RefNannyFinishContext();
  11889. return __pyx_r;
  11890. }
  11891. static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryview_obj *__pyx_v_self) {
  11892. PyObject *__pyx_r = NULL;
  11893. __Pyx_RefNannyDeclarations
  11894. PyObject *__pyx_t_1 = NULL;
  11895. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  11896. /* "(tree fragment)":2
  11897. * def __reduce_cython__(self):
  11898. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  11899. * def __setstate_cython__(self, __pyx_state):
  11900. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11901. */
  11902. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  11903. __Pyx_GOTREF(__pyx_t_1);
  11904. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  11905. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11906. __PYX_ERR(2, 2, __pyx_L1_error)
  11907. /* "(tree fragment)":1
  11908. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  11909. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11910. * def __setstate_cython__(self, __pyx_state):
  11911. */
  11912. /* function exit code */
  11913. __pyx_L1_error:;
  11914. __Pyx_XDECREF(__pyx_t_1);
  11915. __Pyx_AddTraceback("View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11916. __pyx_r = NULL;
  11917. __Pyx_XGIVEREF(__pyx_r);
  11918. __Pyx_RefNannyFinishContext();
  11919. return __pyx_r;
  11920. }
  11921. /* "(tree fragment)":3
  11922. * def __reduce_cython__(self):
  11923. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11924. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  11925. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11926. */
  11927. /* Python wrapper */
  11928. static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  11929. static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  11930. PyObject *__pyx_r = 0;
  11931. __Pyx_RefNannyDeclarations
  11932. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  11933. __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  11934. /* function exit code */
  11935. __Pyx_RefNannyFinishContext();
  11936. return __pyx_r;
  11937. }
  11938. 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) {
  11939. PyObject *__pyx_r = NULL;
  11940. __Pyx_RefNannyDeclarations
  11941. PyObject *__pyx_t_1 = NULL;
  11942. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  11943. /* "(tree fragment)":4
  11944. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11945. * def __setstate_cython__(self, __pyx_state):
  11946. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  11947. */
  11948. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  11949. __Pyx_GOTREF(__pyx_t_1);
  11950. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  11951. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  11952. __PYX_ERR(2, 4, __pyx_L1_error)
  11953. /* "(tree fragment)":3
  11954. * def __reduce_cython__(self):
  11955. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11956. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  11957. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  11958. */
  11959. /* function exit code */
  11960. __pyx_L1_error:;
  11961. __Pyx_XDECREF(__pyx_t_1);
  11962. __Pyx_AddTraceback("View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  11963. __pyx_r = NULL;
  11964. __Pyx_XGIVEREF(__pyx_r);
  11965. __Pyx_RefNannyFinishContext();
  11966. return __pyx_r;
  11967. }
  11968. /* "View.MemoryView":657
  11969. *
  11970. * @cname('__pyx_memoryview_new')
  11971. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
  11972. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  11973. * result.typeinfo = typeinfo
  11974. */
  11975. static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
  11976. struct __pyx_memoryview_obj *__pyx_v_result = 0;
  11977. PyObject *__pyx_r = NULL;
  11978. __Pyx_RefNannyDeclarations
  11979. PyObject *__pyx_t_1 = NULL;
  11980. PyObject *__pyx_t_2 = NULL;
  11981. PyObject *__pyx_t_3 = NULL;
  11982. __Pyx_RefNannySetupContext("memoryview_cwrapper", 0);
  11983. /* "View.MemoryView":658
  11984. * @cname('__pyx_memoryview_new')
  11985. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
  11986. * cdef memoryview result = memoryview(o, flags, dtype_is_object) # <<<<<<<<<<<<<<
  11987. * result.typeinfo = typeinfo
  11988. * return result
  11989. */
  11990. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 658, __pyx_L1_error)
  11991. __Pyx_GOTREF(__pyx_t_1);
  11992. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
  11993. __Pyx_GOTREF(__pyx_t_2);
  11994. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 658, __pyx_L1_error)
  11995. __Pyx_GOTREF(__pyx_t_3);
  11996. __Pyx_INCREF(__pyx_v_o);
  11997. __Pyx_GIVEREF(__pyx_v_o);
  11998. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
  11999. __Pyx_GIVEREF(__pyx_t_1);
  12000. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
  12001. __Pyx_GIVEREF(__pyx_t_2);
  12002. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  12003. __pyx_t_1 = 0;
  12004. __pyx_t_2 = 0;
  12005. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 658, __pyx_L1_error)
  12006. __Pyx_GOTREF(__pyx_t_2);
  12007. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12008. __pyx_v_result = ((struct __pyx_memoryview_obj *)__pyx_t_2);
  12009. __pyx_t_2 = 0;
  12010. /* "View.MemoryView":659
  12011. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo):
  12012. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  12013. * result.typeinfo = typeinfo # <<<<<<<<<<<<<<
  12014. * return result
  12015. *
  12016. */
  12017. __pyx_v_result->typeinfo = __pyx_v_typeinfo;
  12018. /* "View.MemoryView":660
  12019. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  12020. * result.typeinfo = typeinfo
  12021. * return result # <<<<<<<<<<<<<<
  12022. *
  12023. * @cname('__pyx_memoryview_check')
  12024. */
  12025. __Pyx_XDECREF(__pyx_r);
  12026. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  12027. __pyx_r = ((PyObject *)__pyx_v_result);
  12028. goto __pyx_L0;
  12029. /* "View.MemoryView":657
  12030. *
  12031. * @cname('__pyx_memoryview_new')
  12032. * cdef memoryview_cwrapper(object o, int flags, bint dtype_is_object, __Pyx_TypeInfo *typeinfo): # <<<<<<<<<<<<<<
  12033. * cdef memoryview result = memoryview(o, flags, dtype_is_object)
  12034. * result.typeinfo = typeinfo
  12035. */
  12036. /* function exit code */
  12037. __pyx_L1_error:;
  12038. __Pyx_XDECREF(__pyx_t_1);
  12039. __Pyx_XDECREF(__pyx_t_2);
  12040. __Pyx_XDECREF(__pyx_t_3);
  12041. __Pyx_AddTraceback("View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12042. __pyx_r = 0;
  12043. __pyx_L0:;
  12044. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  12045. __Pyx_XGIVEREF(__pyx_r);
  12046. __Pyx_RefNannyFinishContext();
  12047. return __pyx_r;
  12048. }
  12049. /* "View.MemoryView":663
  12050. *
  12051. * @cname('__pyx_memoryview_check')
  12052. * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
  12053. * return isinstance(o, memoryview)
  12054. *
  12055. */
  12056. static CYTHON_INLINE int __pyx_memoryview_check(PyObject *__pyx_v_o) {
  12057. int __pyx_r;
  12058. __Pyx_RefNannyDeclarations
  12059. int __pyx_t_1;
  12060. __Pyx_RefNannySetupContext("memoryview_check", 0);
  12061. /* "View.MemoryView":664
  12062. * @cname('__pyx_memoryview_check')
  12063. * cdef inline bint memoryview_check(object o):
  12064. * return isinstance(o, memoryview) # <<<<<<<<<<<<<<
  12065. *
  12066. * cdef tuple _unellipsify(object index, int ndim):
  12067. */
  12068. __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
  12069. __pyx_r = __pyx_t_1;
  12070. goto __pyx_L0;
  12071. /* "View.MemoryView":663
  12072. *
  12073. * @cname('__pyx_memoryview_check')
  12074. * cdef inline bint memoryview_check(object o): # <<<<<<<<<<<<<<
  12075. * return isinstance(o, memoryview)
  12076. *
  12077. */
  12078. /* function exit code */
  12079. __pyx_L0:;
  12080. __Pyx_RefNannyFinishContext();
  12081. return __pyx_r;
  12082. }
  12083. /* "View.MemoryView":666
  12084. * return isinstance(o, memoryview)
  12085. *
  12086. * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
  12087. * """
  12088. * Replace all ellipses with full slices and fill incomplete indices with
  12089. */
  12090. static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) {
  12091. PyObject *__pyx_v_tup = NULL;
  12092. PyObject *__pyx_v_result = NULL;
  12093. int __pyx_v_have_slices;
  12094. int __pyx_v_seen_ellipsis;
  12095. CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
  12096. PyObject *__pyx_v_item = NULL;
  12097. Py_ssize_t __pyx_v_nslices;
  12098. PyObject *__pyx_r = NULL;
  12099. __Pyx_RefNannyDeclarations
  12100. int __pyx_t_1;
  12101. int __pyx_t_2;
  12102. PyObject *__pyx_t_3 = NULL;
  12103. PyObject *__pyx_t_4 = NULL;
  12104. Py_ssize_t __pyx_t_5;
  12105. PyObject *(*__pyx_t_6)(PyObject *);
  12106. PyObject *__pyx_t_7 = NULL;
  12107. Py_ssize_t __pyx_t_8;
  12108. int __pyx_t_9;
  12109. int __pyx_t_10;
  12110. PyObject *__pyx_t_11 = NULL;
  12111. __Pyx_RefNannySetupContext("_unellipsify", 0);
  12112. /* "View.MemoryView":671
  12113. * full slices.
  12114. * """
  12115. * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
  12116. * tup = (index,)
  12117. * else:
  12118. */
  12119. __pyx_t_1 = PyTuple_Check(__pyx_v_index);
  12120. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  12121. if (__pyx_t_2) {
  12122. /* "View.MemoryView":672
  12123. * """
  12124. * if not isinstance(index, tuple):
  12125. * tup = (index,) # <<<<<<<<<<<<<<
  12126. * else:
  12127. * tup = index
  12128. */
  12129. __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 672, __pyx_L1_error)
  12130. __Pyx_GOTREF(__pyx_t_3);
  12131. __Pyx_INCREF(__pyx_v_index);
  12132. __Pyx_GIVEREF(__pyx_v_index);
  12133. PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
  12134. __pyx_v_tup = __pyx_t_3;
  12135. __pyx_t_3 = 0;
  12136. /* "View.MemoryView":671
  12137. * full slices.
  12138. * """
  12139. * if not isinstance(index, tuple): # <<<<<<<<<<<<<<
  12140. * tup = (index,)
  12141. * else:
  12142. */
  12143. goto __pyx_L3;
  12144. }
  12145. /* "View.MemoryView":674
  12146. * tup = (index,)
  12147. * else:
  12148. * tup = index # <<<<<<<<<<<<<<
  12149. *
  12150. * result = []
  12151. */
  12152. /*else*/ {
  12153. __Pyx_INCREF(__pyx_v_index);
  12154. __pyx_v_tup = __pyx_v_index;
  12155. }
  12156. __pyx_L3:;
  12157. /* "View.MemoryView":676
  12158. * tup = index
  12159. *
  12160. * result = [] # <<<<<<<<<<<<<<
  12161. * have_slices = False
  12162. * seen_ellipsis = False
  12163. */
  12164. __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 676, __pyx_L1_error)
  12165. __Pyx_GOTREF(__pyx_t_3);
  12166. __pyx_v_result = ((PyObject*)__pyx_t_3);
  12167. __pyx_t_3 = 0;
  12168. /* "View.MemoryView":677
  12169. *
  12170. * result = []
  12171. * have_slices = False # <<<<<<<<<<<<<<
  12172. * seen_ellipsis = False
  12173. * for idx, item in enumerate(tup):
  12174. */
  12175. __pyx_v_have_slices = 0;
  12176. /* "View.MemoryView":678
  12177. * result = []
  12178. * have_slices = False
  12179. * seen_ellipsis = False # <<<<<<<<<<<<<<
  12180. * for idx, item in enumerate(tup):
  12181. * if item is Ellipsis:
  12182. */
  12183. __pyx_v_seen_ellipsis = 0;
  12184. /* "View.MemoryView":679
  12185. * have_slices = False
  12186. * seen_ellipsis = False
  12187. * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
  12188. * if item is Ellipsis:
  12189. * if not seen_ellipsis:
  12190. */
  12191. __Pyx_INCREF(__pyx_int_0);
  12192. __pyx_t_3 = __pyx_int_0;
  12193. if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
  12194. __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
  12195. __pyx_t_6 = NULL;
  12196. } else {
  12197. __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 679, __pyx_L1_error)
  12198. __Pyx_GOTREF(__pyx_t_4);
  12199. __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 679, __pyx_L1_error)
  12200. }
  12201. for (;;) {
  12202. if (likely(!__pyx_t_6)) {
  12203. if (likely(PyList_CheckExact(__pyx_t_4))) {
  12204. if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
  12205. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12206. __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(2, 679, __pyx_L1_error)
  12207. #else
  12208. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
  12209. __Pyx_GOTREF(__pyx_t_7);
  12210. #endif
  12211. } else {
  12212. if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
  12213. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12214. __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(2, 679, __pyx_L1_error)
  12215. #else
  12216. __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
  12217. __Pyx_GOTREF(__pyx_t_7);
  12218. #endif
  12219. }
  12220. } else {
  12221. __pyx_t_7 = __pyx_t_6(__pyx_t_4);
  12222. if (unlikely(!__pyx_t_7)) {
  12223. PyObject* exc_type = PyErr_Occurred();
  12224. if (exc_type) {
  12225. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  12226. else __PYX_ERR(2, 679, __pyx_L1_error)
  12227. }
  12228. break;
  12229. }
  12230. __Pyx_GOTREF(__pyx_t_7);
  12231. }
  12232. __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
  12233. __pyx_t_7 = 0;
  12234. __Pyx_INCREF(__pyx_t_3);
  12235. __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
  12236. __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 679, __pyx_L1_error)
  12237. __Pyx_GOTREF(__pyx_t_7);
  12238. __Pyx_DECREF(__pyx_t_3);
  12239. __pyx_t_3 = __pyx_t_7;
  12240. __pyx_t_7 = 0;
  12241. /* "View.MemoryView":680
  12242. * seen_ellipsis = False
  12243. * for idx, item in enumerate(tup):
  12244. * if item is Ellipsis: # <<<<<<<<<<<<<<
  12245. * if not seen_ellipsis:
  12246. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  12247. */
  12248. __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
  12249. __pyx_t_1 = (__pyx_t_2 != 0);
  12250. if (__pyx_t_1) {
  12251. /* "View.MemoryView":681
  12252. * for idx, item in enumerate(tup):
  12253. * if item is Ellipsis:
  12254. * if not seen_ellipsis: # <<<<<<<<<<<<<<
  12255. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  12256. * seen_ellipsis = True
  12257. */
  12258. __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
  12259. if (__pyx_t_1) {
  12260. /* "View.MemoryView":682
  12261. * if item is Ellipsis:
  12262. * if not seen_ellipsis:
  12263. * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
  12264. * seen_ellipsis = True
  12265. * else:
  12266. */
  12267. __pyx_t_8 = PyObject_Length(__pyx_v_tup); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
  12268. __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(2, 682, __pyx_L1_error)
  12269. __Pyx_GOTREF(__pyx_t_7);
  12270. { Py_ssize_t __pyx_temp;
  12271. for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
  12272. __Pyx_INCREF(__pyx_slice__24);
  12273. __Pyx_GIVEREF(__pyx_slice__24);
  12274. PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__24);
  12275. }
  12276. }
  12277. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 682, __pyx_L1_error)
  12278. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  12279. /* "View.MemoryView":683
  12280. * if not seen_ellipsis:
  12281. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  12282. * seen_ellipsis = True # <<<<<<<<<<<<<<
  12283. * else:
  12284. * result.append(slice(None))
  12285. */
  12286. __pyx_v_seen_ellipsis = 1;
  12287. /* "View.MemoryView":681
  12288. * for idx, item in enumerate(tup):
  12289. * if item is Ellipsis:
  12290. * if not seen_ellipsis: # <<<<<<<<<<<<<<
  12291. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  12292. * seen_ellipsis = True
  12293. */
  12294. goto __pyx_L7;
  12295. }
  12296. /* "View.MemoryView":685
  12297. * seen_ellipsis = True
  12298. * else:
  12299. * result.append(slice(None)) # <<<<<<<<<<<<<<
  12300. * have_slices = True
  12301. * else:
  12302. */
  12303. /*else*/ {
  12304. __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__24); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 685, __pyx_L1_error)
  12305. }
  12306. __pyx_L7:;
  12307. /* "View.MemoryView":686
  12308. * else:
  12309. * result.append(slice(None))
  12310. * have_slices = True # <<<<<<<<<<<<<<
  12311. * else:
  12312. * if not isinstance(item, slice) and not PyIndex_Check(item):
  12313. */
  12314. __pyx_v_have_slices = 1;
  12315. /* "View.MemoryView":680
  12316. * seen_ellipsis = False
  12317. * for idx, item in enumerate(tup):
  12318. * if item is Ellipsis: # <<<<<<<<<<<<<<
  12319. * if not seen_ellipsis:
  12320. * result.extend([slice(None)] * (ndim - len(tup) + 1))
  12321. */
  12322. goto __pyx_L6;
  12323. }
  12324. /* "View.MemoryView":688
  12325. * have_slices = True
  12326. * else:
  12327. * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
  12328. * raise TypeError("Cannot index with type '%s'" % type(item))
  12329. *
  12330. */
  12331. /*else*/ {
  12332. __pyx_t_2 = PySlice_Check(__pyx_v_item);
  12333. __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
  12334. if (__pyx_t_10) {
  12335. } else {
  12336. __pyx_t_1 = __pyx_t_10;
  12337. goto __pyx_L9_bool_binop_done;
  12338. }
  12339. __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
  12340. __pyx_t_1 = __pyx_t_10;
  12341. __pyx_L9_bool_binop_done:;
  12342. if (unlikely(__pyx_t_1)) {
  12343. /* "View.MemoryView":689
  12344. * else:
  12345. * if not isinstance(item, slice) and not PyIndex_Check(item):
  12346. * raise TypeError("Cannot index with type '%s'" % type(item)) # <<<<<<<<<<<<<<
  12347. *
  12348. * have_slices = have_slices or isinstance(item, slice)
  12349. */
  12350. __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(2, 689, __pyx_L1_error)
  12351. __Pyx_GOTREF(__pyx_t_7);
  12352. __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 689, __pyx_L1_error)
  12353. __Pyx_GOTREF(__pyx_t_11);
  12354. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  12355. __Pyx_Raise(__pyx_t_11, 0, 0, 0);
  12356. __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  12357. __PYX_ERR(2, 689, __pyx_L1_error)
  12358. /* "View.MemoryView":688
  12359. * have_slices = True
  12360. * else:
  12361. * if not isinstance(item, slice) and not PyIndex_Check(item): # <<<<<<<<<<<<<<
  12362. * raise TypeError("Cannot index with type '%s'" % type(item))
  12363. *
  12364. */
  12365. }
  12366. /* "View.MemoryView":691
  12367. * raise TypeError("Cannot index with type '%s'" % type(item))
  12368. *
  12369. * have_slices = have_slices or isinstance(item, slice) # <<<<<<<<<<<<<<
  12370. * result.append(item)
  12371. *
  12372. */
  12373. __pyx_t_10 = (__pyx_v_have_slices != 0);
  12374. if (!__pyx_t_10) {
  12375. } else {
  12376. __pyx_t_1 = __pyx_t_10;
  12377. goto __pyx_L11_bool_binop_done;
  12378. }
  12379. __pyx_t_10 = PySlice_Check(__pyx_v_item);
  12380. __pyx_t_2 = (__pyx_t_10 != 0);
  12381. __pyx_t_1 = __pyx_t_2;
  12382. __pyx_L11_bool_binop_done:;
  12383. __pyx_v_have_slices = __pyx_t_1;
  12384. /* "View.MemoryView":692
  12385. *
  12386. * have_slices = have_slices or isinstance(item, slice)
  12387. * result.append(item) # <<<<<<<<<<<<<<
  12388. *
  12389. * nslices = ndim - len(result)
  12390. */
  12391. __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 692, __pyx_L1_error)
  12392. }
  12393. __pyx_L6:;
  12394. /* "View.MemoryView":679
  12395. * have_slices = False
  12396. * seen_ellipsis = False
  12397. * for idx, item in enumerate(tup): # <<<<<<<<<<<<<<
  12398. * if item is Ellipsis:
  12399. * if not seen_ellipsis:
  12400. */
  12401. }
  12402. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  12403. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12404. /* "View.MemoryView":694
  12405. * result.append(item)
  12406. *
  12407. * nslices = ndim - len(result) # <<<<<<<<<<<<<<
  12408. * if nslices:
  12409. * result.extend([slice(None)] * nslices)
  12410. */
  12411. __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
  12412. __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
  12413. /* "View.MemoryView":695
  12414. *
  12415. * nslices = ndim - len(result)
  12416. * if nslices: # <<<<<<<<<<<<<<
  12417. * result.extend([slice(None)] * nslices)
  12418. *
  12419. */
  12420. __pyx_t_1 = (__pyx_v_nslices != 0);
  12421. if (__pyx_t_1) {
  12422. /* "View.MemoryView":696
  12423. * nslices = ndim - len(result)
  12424. * if nslices:
  12425. * result.extend([slice(None)] * nslices) # <<<<<<<<<<<<<<
  12426. *
  12427. * return have_slices or nslices, tuple(result)
  12428. */
  12429. __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices)); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 696, __pyx_L1_error)
  12430. __Pyx_GOTREF(__pyx_t_3);
  12431. { Py_ssize_t __pyx_temp;
  12432. for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
  12433. __Pyx_INCREF(__pyx_slice__24);
  12434. __Pyx_GIVEREF(__pyx_slice__24);
  12435. PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__24);
  12436. }
  12437. }
  12438. __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3); if (unlikely(__pyx_t_9 == ((int)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
  12439. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  12440. /* "View.MemoryView":695
  12441. *
  12442. * nslices = ndim - len(result)
  12443. * if nslices: # <<<<<<<<<<<<<<
  12444. * result.extend([slice(None)] * nslices)
  12445. *
  12446. */
  12447. }
  12448. /* "View.MemoryView":698
  12449. * result.extend([slice(None)] * nslices)
  12450. *
  12451. * return have_slices or nslices, tuple(result) # <<<<<<<<<<<<<<
  12452. *
  12453. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  12454. */
  12455. __Pyx_XDECREF(__pyx_r);
  12456. if (!__pyx_v_have_slices) {
  12457. } else {
  12458. __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
  12459. __Pyx_GOTREF(__pyx_t_4);
  12460. __pyx_t_3 = __pyx_t_4;
  12461. __pyx_t_4 = 0;
  12462. goto __pyx_L14_bool_binop_done;
  12463. }
  12464. __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
  12465. __Pyx_GOTREF(__pyx_t_4);
  12466. __pyx_t_3 = __pyx_t_4;
  12467. __pyx_t_4 = 0;
  12468. __pyx_L14_bool_binop_done:;
  12469. __pyx_t_4 = PyList_AsTuple(__pyx_v_result); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 698, __pyx_L1_error)
  12470. __Pyx_GOTREF(__pyx_t_4);
  12471. __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 698, __pyx_L1_error)
  12472. __Pyx_GOTREF(__pyx_t_11);
  12473. __Pyx_GIVEREF(__pyx_t_3);
  12474. PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
  12475. __Pyx_GIVEREF(__pyx_t_4);
  12476. PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
  12477. __pyx_t_3 = 0;
  12478. __pyx_t_4 = 0;
  12479. __pyx_r = ((PyObject*)__pyx_t_11);
  12480. __pyx_t_11 = 0;
  12481. goto __pyx_L0;
  12482. /* "View.MemoryView":666
  12483. * return isinstance(o, memoryview)
  12484. *
  12485. * cdef tuple _unellipsify(object index, int ndim): # <<<<<<<<<<<<<<
  12486. * """
  12487. * Replace all ellipses with full slices and fill incomplete indices with
  12488. */
  12489. /* function exit code */
  12490. __pyx_L1_error:;
  12491. __Pyx_XDECREF(__pyx_t_3);
  12492. __Pyx_XDECREF(__pyx_t_4);
  12493. __Pyx_XDECREF(__pyx_t_7);
  12494. __Pyx_XDECREF(__pyx_t_11);
  12495. __Pyx_AddTraceback("View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12496. __pyx_r = 0;
  12497. __pyx_L0:;
  12498. __Pyx_XDECREF(__pyx_v_tup);
  12499. __Pyx_XDECREF(__pyx_v_result);
  12500. __Pyx_XDECREF(__pyx_v_idx);
  12501. __Pyx_XDECREF(__pyx_v_item);
  12502. __Pyx_XGIVEREF(__pyx_r);
  12503. __Pyx_RefNannyFinishContext();
  12504. return __pyx_r;
  12505. }
  12506. /* "View.MemoryView":700
  12507. * return have_slices or nslices, tuple(result)
  12508. *
  12509. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
  12510. * for suboffset in suboffsets[:ndim]:
  12511. * if suboffset >= 0:
  12512. */
  12513. static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __pyx_v_ndim) {
  12514. Py_ssize_t __pyx_v_suboffset;
  12515. PyObject *__pyx_r = NULL;
  12516. __Pyx_RefNannyDeclarations
  12517. Py_ssize_t *__pyx_t_1;
  12518. Py_ssize_t *__pyx_t_2;
  12519. Py_ssize_t *__pyx_t_3;
  12520. int __pyx_t_4;
  12521. PyObject *__pyx_t_5 = NULL;
  12522. __Pyx_RefNannySetupContext("assert_direct_dimensions", 0);
  12523. /* "View.MemoryView":701
  12524. *
  12525. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  12526. * for suboffset in suboffsets[:ndim]: # <<<<<<<<<<<<<<
  12527. * if suboffset >= 0:
  12528. * raise ValueError("Indirect dimensions not supported")
  12529. */
  12530. __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
  12531. for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
  12532. __pyx_t_1 = __pyx_t_3;
  12533. __pyx_v_suboffset = (__pyx_t_1[0]);
  12534. /* "View.MemoryView":702
  12535. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  12536. * for suboffset in suboffsets[:ndim]:
  12537. * if suboffset >= 0: # <<<<<<<<<<<<<<
  12538. * raise ValueError("Indirect dimensions not supported")
  12539. *
  12540. */
  12541. __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
  12542. if (unlikely(__pyx_t_4)) {
  12543. /* "View.MemoryView":703
  12544. * for suboffset in suboffsets[:ndim]:
  12545. * if suboffset >= 0:
  12546. * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
  12547. *
  12548. *
  12549. */
  12550. __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 703, __pyx_L1_error)
  12551. __Pyx_GOTREF(__pyx_t_5);
  12552. __Pyx_Raise(__pyx_t_5, 0, 0, 0);
  12553. __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  12554. __PYX_ERR(2, 703, __pyx_L1_error)
  12555. /* "View.MemoryView":702
  12556. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim):
  12557. * for suboffset in suboffsets[:ndim]:
  12558. * if suboffset >= 0: # <<<<<<<<<<<<<<
  12559. * raise ValueError("Indirect dimensions not supported")
  12560. *
  12561. */
  12562. }
  12563. }
  12564. /* "View.MemoryView":700
  12565. * return have_slices or nslices, tuple(result)
  12566. *
  12567. * cdef assert_direct_dimensions(Py_ssize_t *suboffsets, int ndim): # <<<<<<<<<<<<<<
  12568. * for suboffset in suboffsets[:ndim]:
  12569. * if suboffset >= 0:
  12570. */
  12571. /* function exit code */
  12572. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  12573. goto __pyx_L0;
  12574. __pyx_L1_error:;
  12575. __Pyx_XDECREF(__pyx_t_5);
  12576. __Pyx_AddTraceback("View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
  12577. __pyx_r = 0;
  12578. __pyx_L0:;
  12579. __Pyx_XGIVEREF(__pyx_r);
  12580. __Pyx_RefNannyFinishContext();
  12581. return __pyx_r;
  12582. }
  12583. /* "View.MemoryView":710
  12584. *
  12585. * @cname('__pyx_memview_slice')
  12586. * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
  12587. * cdef int new_ndim = 0, suboffset_dim = -1, dim
  12588. * cdef bint negative_step
  12589. */
  12590. static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
  12591. int __pyx_v_new_ndim;
  12592. int __pyx_v_suboffset_dim;
  12593. int __pyx_v_dim;
  12594. __Pyx_memviewslice __pyx_v_src;
  12595. __Pyx_memviewslice __pyx_v_dst;
  12596. __Pyx_memviewslice *__pyx_v_p_src;
  12597. struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
  12598. __Pyx_memviewslice *__pyx_v_p_dst;
  12599. int *__pyx_v_p_suboffset_dim;
  12600. Py_ssize_t __pyx_v_start;
  12601. Py_ssize_t __pyx_v_stop;
  12602. Py_ssize_t __pyx_v_step;
  12603. int __pyx_v_have_start;
  12604. int __pyx_v_have_stop;
  12605. int __pyx_v_have_step;
  12606. PyObject *__pyx_v_index = NULL;
  12607. struct __pyx_memoryview_obj *__pyx_r = NULL;
  12608. __Pyx_RefNannyDeclarations
  12609. int __pyx_t_1;
  12610. int __pyx_t_2;
  12611. PyObject *__pyx_t_3 = NULL;
  12612. struct __pyx_memoryview_obj *__pyx_t_4;
  12613. char *__pyx_t_5;
  12614. int __pyx_t_6;
  12615. Py_ssize_t __pyx_t_7;
  12616. PyObject *(*__pyx_t_8)(PyObject *);
  12617. PyObject *__pyx_t_9 = NULL;
  12618. Py_ssize_t __pyx_t_10;
  12619. int __pyx_t_11;
  12620. Py_ssize_t __pyx_t_12;
  12621. __Pyx_RefNannySetupContext("memview_slice", 0);
  12622. /* "View.MemoryView":711
  12623. * @cname('__pyx_memview_slice')
  12624. * cdef memoryview memview_slice(memoryview memview, object indices):
  12625. * cdef int new_ndim = 0, suboffset_dim = -1, dim # <<<<<<<<<<<<<<
  12626. * cdef bint negative_step
  12627. * cdef __Pyx_memviewslice src, dst
  12628. */
  12629. __pyx_v_new_ndim = 0;
  12630. __pyx_v_suboffset_dim = -1;
  12631. /* "View.MemoryView":718
  12632. *
  12633. *
  12634. * memset(&dst, 0, sizeof(dst)) # <<<<<<<<<<<<<<
  12635. *
  12636. * cdef _memoryviewslice memviewsliceobj
  12637. */
  12638. (void)(memset((&__pyx_v_dst), 0, (sizeof(__pyx_v_dst))));
  12639. /* "View.MemoryView":722
  12640. * cdef _memoryviewslice memviewsliceobj
  12641. *
  12642. * assert memview.view.ndim > 0 # <<<<<<<<<<<<<<
  12643. *
  12644. * if isinstance(memview, _memoryviewslice):
  12645. */
  12646. #ifndef CYTHON_WITHOUT_ASSERTIONS
  12647. if (unlikely(!Py_OptimizeFlag)) {
  12648. if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
  12649. PyErr_SetNone(PyExc_AssertionError);
  12650. __PYX_ERR(2, 722, __pyx_L1_error)
  12651. }
  12652. }
  12653. #endif
  12654. /* "View.MemoryView":724
  12655. * assert memview.view.ndim > 0
  12656. *
  12657. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12658. * memviewsliceobj = memview
  12659. * p_src = &memviewsliceobj.from_slice
  12660. */
  12661. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  12662. __pyx_t_2 = (__pyx_t_1 != 0);
  12663. if (__pyx_t_2) {
  12664. /* "View.MemoryView":725
  12665. *
  12666. * if isinstance(memview, _memoryviewslice):
  12667. * memviewsliceobj = memview # <<<<<<<<<<<<<<
  12668. * p_src = &memviewsliceobj.from_slice
  12669. * else:
  12670. */
  12671. if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 725, __pyx_L1_error)
  12672. __pyx_t_3 = ((PyObject *)__pyx_v_memview);
  12673. __Pyx_INCREF(__pyx_t_3);
  12674. __pyx_v_memviewsliceobj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
  12675. __pyx_t_3 = 0;
  12676. /* "View.MemoryView":726
  12677. * if isinstance(memview, _memoryviewslice):
  12678. * memviewsliceobj = memview
  12679. * p_src = &memviewsliceobj.from_slice # <<<<<<<<<<<<<<
  12680. * else:
  12681. * slice_copy(memview, &src)
  12682. */
  12683. __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
  12684. /* "View.MemoryView":724
  12685. * assert memview.view.ndim > 0
  12686. *
  12687. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  12688. * memviewsliceobj = memview
  12689. * p_src = &memviewsliceobj.from_slice
  12690. */
  12691. goto __pyx_L3;
  12692. }
  12693. /* "View.MemoryView":728
  12694. * p_src = &memviewsliceobj.from_slice
  12695. * else:
  12696. * slice_copy(memview, &src) # <<<<<<<<<<<<<<
  12697. * p_src = &src
  12698. *
  12699. */
  12700. /*else*/ {
  12701. __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
  12702. /* "View.MemoryView":729
  12703. * else:
  12704. * slice_copy(memview, &src)
  12705. * p_src = &src # <<<<<<<<<<<<<<
  12706. *
  12707. *
  12708. */
  12709. __pyx_v_p_src = (&__pyx_v_src);
  12710. }
  12711. __pyx_L3:;
  12712. /* "View.MemoryView":735
  12713. *
  12714. *
  12715. * dst.memview = p_src.memview # <<<<<<<<<<<<<<
  12716. * dst.data = p_src.data
  12717. *
  12718. */
  12719. __pyx_t_4 = __pyx_v_p_src->memview;
  12720. __pyx_v_dst.memview = __pyx_t_4;
  12721. /* "View.MemoryView":736
  12722. *
  12723. * dst.memview = p_src.memview
  12724. * dst.data = p_src.data # <<<<<<<<<<<<<<
  12725. *
  12726. *
  12727. */
  12728. __pyx_t_5 = __pyx_v_p_src->data;
  12729. __pyx_v_dst.data = __pyx_t_5;
  12730. /* "View.MemoryView":741
  12731. *
  12732. *
  12733. * cdef __Pyx_memviewslice *p_dst = &dst # <<<<<<<<<<<<<<
  12734. * cdef int *p_suboffset_dim = &suboffset_dim
  12735. * cdef Py_ssize_t start, stop, step
  12736. */
  12737. __pyx_v_p_dst = (&__pyx_v_dst);
  12738. /* "View.MemoryView":742
  12739. *
  12740. * cdef __Pyx_memviewslice *p_dst = &dst
  12741. * cdef int *p_suboffset_dim = &suboffset_dim # <<<<<<<<<<<<<<
  12742. * cdef Py_ssize_t start, stop, step
  12743. * cdef bint have_start, have_stop, have_step
  12744. */
  12745. __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
  12746. /* "View.MemoryView":746
  12747. * cdef bint have_start, have_stop, have_step
  12748. *
  12749. * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
  12750. * if PyIndex_Check(index):
  12751. * slice_memviewslice(
  12752. */
  12753. __pyx_t_6 = 0;
  12754. if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
  12755. __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
  12756. __pyx_t_8 = NULL;
  12757. } else {
  12758. __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 746, __pyx_L1_error)
  12759. __Pyx_GOTREF(__pyx_t_3);
  12760. __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 746, __pyx_L1_error)
  12761. }
  12762. for (;;) {
  12763. if (likely(!__pyx_t_8)) {
  12764. if (likely(PyList_CheckExact(__pyx_t_3))) {
  12765. if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break;
  12766. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12767. __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(2, 746, __pyx_L1_error)
  12768. #else
  12769. __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
  12770. __Pyx_GOTREF(__pyx_t_9);
  12771. #endif
  12772. } else {
  12773. if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
  12774. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  12775. __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(2, 746, __pyx_L1_error)
  12776. #else
  12777. __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 746, __pyx_L1_error)
  12778. __Pyx_GOTREF(__pyx_t_9);
  12779. #endif
  12780. }
  12781. } else {
  12782. __pyx_t_9 = __pyx_t_8(__pyx_t_3);
  12783. if (unlikely(!__pyx_t_9)) {
  12784. PyObject* exc_type = PyErr_Occurred();
  12785. if (exc_type) {
  12786. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
  12787. else __PYX_ERR(2, 746, __pyx_L1_error)
  12788. }
  12789. break;
  12790. }
  12791. __Pyx_GOTREF(__pyx_t_9);
  12792. }
  12793. __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
  12794. __pyx_t_9 = 0;
  12795. __pyx_v_dim = __pyx_t_6;
  12796. __pyx_t_6 = (__pyx_t_6 + 1);
  12797. /* "View.MemoryView":747
  12798. *
  12799. * for dim, index in enumerate(indices):
  12800. * if PyIndex_Check(index): # <<<<<<<<<<<<<<
  12801. * slice_memviewslice(
  12802. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  12803. */
  12804. __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
  12805. if (__pyx_t_2) {
  12806. /* "View.MemoryView":751
  12807. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  12808. * dim, new_ndim, p_suboffset_dim,
  12809. * index, 0, 0, # start, stop, step # <<<<<<<<<<<<<<
  12810. * 0, 0, 0, # have_{start,stop,step}
  12811. * False)
  12812. */
  12813. __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index); if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 751, __pyx_L1_error)
  12814. /* "View.MemoryView":748
  12815. * for dim, index in enumerate(indices):
  12816. * if PyIndex_Check(index):
  12817. * slice_memviewslice( # <<<<<<<<<<<<<<
  12818. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  12819. * dim, new_ndim, p_suboffset_dim,
  12820. */
  12821. __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(2, 748, __pyx_L1_error)
  12822. /* "View.MemoryView":747
  12823. *
  12824. * for dim, index in enumerate(indices):
  12825. * if PyIndex_Check(index): # <<<<<<<<<<<<<<
  12826. * slice_memviewslice(
  12827. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  12828. */
  12829. goto __pyx_L6;
  12830. }
  12831. /* "View.MemoryView":754
  12832. * 0, 0, 0, # have_{start,stop,step}
  12833. * False)
  12834. * elif index is None: # <<<<<<<<<<<<<<
  12835. * p_dst.shape[new_ndim] = 1
  12836. * p_dst.strides[new_ndim] = 0
  12837. */
  12838. __pyx_t_2 = (__pyx_v_index == Py_None);
  12839. __pyx_t_1 = (__pyx_t_2 != 0);
  12840. if (__pyx_t_1) {
  12841. /* "View.MemoryView":755
  12842. * False)
  12843. * elif index is None:
  12844. * p_dst.shape[new_ndim] = 1 # <<<<<<<<<<<<<<
  12845. * p_dst.strides[new_ndim] = 0
  12846. * p_dst.suboffsets[new_ndim] = -1
  12847. */
  12848. (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
  12849. /* "View.MemoryView":756
  12850. * elif index is None:
  12851. * p_dst.shape[new_ndim] = 1
  12852. * p_dst.strides[new_ndim] = 0 # <<<<<<<<<<<<<<
  12853. * p_dst.suboffsets[new_ndim] = -1
  12854. * new_ndim += 1
  12855. */
  12856. (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
  12857. /* "View.MemoryView":757
  12858. * p_dst.shape[new_ndim] = 1
  12859. * p_dst.strides[new_ndim] = 0
  12860. * p_dst.suboffsets[new_ndim] = -1 # <<<<<<<<<<<<<<
  12861. * new_ndim += 1
  12862. * else:
  12863. */
  12864. (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
  12865. /* "View.MemoryView":758
  12866. * p_dst.strides[new_ndim] = 0
  12867. * p_dst.suboffsets[new_ndim] = -1
  12868. * new_ndim += 1 # <<<<<<<<<<<<<<
  12869. * else:
  12870. * start = index.start or 0
  12871. */
  12872. __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
  12873. /* "View.MemoryView":754
  12874. * 0, 0, 0, # have_{start,stop,step}
  12875. * False)
  12876. * elif index is None: # <<<<<<<<<<<<<<
  12877. * p_dst.shape[new_ndim] = 1
  12878. * p_dst.strides[new_ndim] = 0
  12879. */
  12880. goto __pyx_L6;
  12881. }
  12882. /* "View.MemoryView":760
  12883. * new_ndim += 1
  12884. * else:
  12885. * start = index.start or 0 # <<<<<<<<<<<<<<
  12886. * stop = index.stop or 0
  12887. * step = index.step or 0
  12888. */
  12889. /*else*/ {
  12890. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 760, __pyx_L1_error)
  12891. __Pyx_GOTREF(__pyx_t_9);
  12892. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 760, __pyx_L1_error)
  12893. if (!__pyx_t_1) {
  12894. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12895. } else {
  12896. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 760, __pyx_L1_error)
  12897. __pyx_t_10 = __pyx_t_12;
  12898. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12899. goto __pyx_L7_bool_binop_done;
  12900. }
  12901. __pyx_t_10 = 0;
  12902. __pyx_L7_bool_binop_done:;
  12903. __pyx_v_start = __pyx_t_10;
  12904. /* "View.MemoryView":761
  12905. * else:
  12906. * start = index.start or 0
  12907. * stop = index.stop or 0 # <<<<<<<<<<<<<<
  12908. * step = index.step or 0
  12909. *
  12910. */
  12911. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 761, __pyx_L1_error)
  12912. __Pyx_GOTREF(__pyx_t_9);
  12913. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 761, __pyx_L1_error)
  12914. if (!__pyx_t_1) {
  12915. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12916. } else {
  12917. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 761, __pyx_L1_error)
  12918. __pyx_t_10 = __pyx_t_12;
  12919. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12920. goto __pyx_L9_bool_binop_done;
  12921. }
  12922. __pyx_t_10 = 0;
  12923. __pyx_L9_bool_binop_done:;
  12924. __pyx_v_stop = __pyx_t_10;
  12925. /* "View.MemoryView":762
  12926. * start = index.start or 0
  12927. * stop = index.stop or 0
  12928. * step = index.step or 0 # <<<<<<<<<<<<<<
  12929. *
  12930. * have_start = index.start is not None
  12931. */
  12932. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
  12933. __Pyx_GOTREF(__pyx_t_9);
  12934. __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
  12935. if (!__pyx_t_1) {
  12936. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12937. } else {
  12938. __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
  12939. __pyx_t_10 = __pyx_t_12;
  12940. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12941. goto __pyx_L11_bool_binop_done;
  12942. }
  12943. __pyx_t_10 = 0;
  12944. __pyx_L11_bool_binop_done:;
  12945. __pyx_v_step = __pyx_t_10;
  12946. /* "View.MemoryView":764
  12947. * step = index.step or 0
  12948. *
  12949. * have_start = index.start is not None # <<<<<<<<<<<<<<
  12950. * have_stop = index.stop is not None
  12951. * have_step = index.step is not None
  12952. */
  12953. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
  12954. __Pyx_GOTREF(__pyx_t_9);
  12955. __pyx_t_1 = (__pyx_t_9 != Py_None);
  12956. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12957. __pyx_v_have_start = __pyx_t_1;
  12958. /* "View.MemoryView":765
  12959. *
  12960. * have_start = index.start is not None
  12961. * have_stop = index.stop is not None # <<<<<<<<<<<<<<
  12962. * have_step = index.step is not None
  12963. *
  12964. */
  12965. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 765, __pyx_L1_error)
  12966. __Pyx_GOTREF(__pyx_t_9);
  12967. __pyx_t_1 = (__pyx_t_9 != Py_None);
  12968. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12969. __pyx_v_have_stop = __pyx_t_1;
  12970. /* "View.MemoryView":766
  12971. * have_start = index.start is not None
  12972. * have_stop = index.stop is not None
  12973. * have_step = index.step is not None # <<<<<<<<<<<<<<
  12974. *
  12975. * slice_memviewslice(
  12976. */
  12977. __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step); if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
  12978. __Pyx_GOTREF(__pyx_t_9);
  12979. __pyx_t_1 = (__pyx_t_9 != Py_None);
  12980. __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  12981. __pyx_v_have_step = __pyx_t_1;
  12982. /* "View.MemoryView":768
  12983. * have_step = index.step is not None
  12984. *
  12985. * slice_memviewslice( # <<<<<<<<<<<<<<
  12986. * p_dst, p_src.shape[dim], p_src.strides[dim], p_src.suboffsets[dim],
  12987. * dim, new_ndim, p_suboffset_dim,
  12988. */
  12989. __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(2, 768, __pyx_L1_error)
  12990. /* "View.MemoryView":774
  12991. * have_start, have_stop, have_step,
  12992. * True)
  12993. * new_ndim += 1 # <<<<<<<<<<<<<<
  12994. *
  12995. * if isinstance(memview, _memoryviewslice):
  12996. */
  12997. __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
  12998. }
  12999. __pyx_L6:;
  13000. /* "View.MemoryView":746
  13001. * cdef bint have_start, have_stop, have_step
  13002. *
  13003. * for dim, index in enumerate(indices): # <<<<<<<<<<<<<<
  13004. * if PyIndex_Check(index):
  13005. * slice_memviewslice(
  13006. */
  13007. }
  13008. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13009. /* "View.MemoryView":776
  13010. * new_ndim += 1
  13011. *
  13012. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  13013. * return memoryview_fromslice(dst, new_ndim,
  13014. * memviewsliceobj.to_object_func,
  13015. */
  13016. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  13017. __pyx_t_2 = (__pyx_t_1 != 0);
  13018. if (__pyx_t_2) {
  13019. /* "View.MemoryView":777
  13020. *
  13021. * if isinstance(memview, _memoryviewslice):
  13022. * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
  13023. * memviewsliceobj.to_object_func,
  13024. * memviewsliceobj.to_dtype_func,
  13025. */
  13026. __Pyx_XDECREF(((PyObject *)__pyx_r));
  13027. /* "View.MemoryView":778
  13028. * if isinstance(memview, _memoryviewslice):
  13029. * return memoryview_fromslice(dst, new_ndim,
  13030. * memviewsliceobj.to_object_func, # <<<<<<<<<<<<<<
  13031. * memviewsliceobj.to_dtype_func,
  13032. * memview.dtype_is_object)
  13033. */
  13034. if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 778, __pyx_L1_error) }
  13035. /* "View.MemoryView":779
  13036. * return memoryview_fromslice(dst, new_ndim,
  13037. * memviewsliceobj.to_object_func,
  13038. * memviewsliceobj.to_dtype_func, # <<<<<<<<<<<<<<
  13039. * memview.dtype_is_object)
  13040. * else:
  13041. */
  13042. if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError("memviewsliceobj"); __PYX_ERR(2, 779, __pyx_L1_error) }
  13043. /* "View.MemoryView":777
  13044. *
  13045. * if isinstance(memview, _memoryviewslice):
  13046. * return memoryview_fromslice(dst, new_ndim, # <<<<<<<<<<<<<<
  13047. * memviewsliceobj.to_object_func,
  13048. * memviewsliceobj.to_dtype_func,
  13049. */
  13050. __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(2, 777, __pyx_L1_error)
  13051. __Pyx_GOTREF(__pyx_t_3);
  13052. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 777, __pyx_L1_error)
  13053. __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
  13054. __pyx_t_3 = 0;
  13055. goto __pyx_L0;
  13056. /* "View.MemoryView":776
  13057. * new_ndim += 1
  13058. *
  13059. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  13060. * return memoryview_fromslice(dst, new_ndim,
  13061. * memviewsliceobj.to_object_func,
  13062. */
  13063. }
  13064. /* "View.MemoryView":782
  13065. * memview.dtype_is_object)
  13066. * else:
  13067. * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
  13068. * memview.dtype_is_object)
  13069. *
  13070. */
  13071. /*else*/ {
  13072. __Pyx_XDECREF(((PyObject *)__pyx_r));
  13073. /* "View.MemoryView":783
  13074. * else:
  13075. * return memoryview_fromslice(dst, new_ndim, NULL, NULL,
  13076. * memview.dtype_is_object) # <<<<<<<<<<<<<<
  13077. *
  13078. *
  13079. */
  13080. __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(2, 782, __pyx_L1_error)
  13081. __Pyx_GOTREF(__pyx_t_3);
  13082. /* "View.MemoryView":782
  13083. * memview.dtype_is_object)
  13084. * else:
  13085. * return memoryview_fromslice(dst, new_ndim, NULL, NULL, # <<<<<<<<<<<<<<
  13086. * memview.dtype_is_object)
  13087. *
  13088. */
  13089. if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 782, __pyx_L1_error)
  13090. __pyx_r = ((struct __pyx_memoryview_obj *)__pyx_t_3);
  13091. __pyx_t_3 = 0;
  13092. goto __pyx_L0;
  13093. }
  13094. /* "View.MemoryView":710
  13095. *
  13096. * @cname('__pyx_memview_slice')
  13097. * cdef memoryview memview_slice(memoryview memview, object indices): # <<<<<<<<<<<<<<
  13098. * cdef int new_ndim = 0, suboffset_dim = -1, dim
  13099. * cdef bint negative_step
  13100. */
  13101. /* function exit code */
  13102. __pyx_L1_error:;
  13103. __Pyx_XDECREF(__pyx_t_3);
  13104. __Pyx_XDECREF(__pyx_t_9);
  13105. __Pyx_AddTraceback("View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13106. __pyx_r = 0;
  13107. __pyx_L0:;
  13108. __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
  13109. __Pyx_XDECREF(__pyx_v_index);
  13110. __Pyx_XGIVEREF((PyObject *)__pyx_r);
  13111. __Pyx_RefNannyFinishContext();
  13112. return __pyx_r;
  13113. }
  13114. /* "View.MemoryView":807
  13115. *
  13116. * @cname('__pyx_memoryview_slice_memviewslice')
  13117. * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
  13118. * __Pyx_memviewslice *dst,
  13119. * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
  13120. */
  13121. 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) {
  13122. Py_ssize_t __pyx_v_new_shape;
  13123. int __pyx_v_negative_step;
  13124. int __pyx_r;
  13125. int __pyx_t_1;
  13126. int __pyx_t_2;
  13127. int __pyx_t_3;
  13128. /* "View.MemoryView":827
  13129. * cdef bint negative_step
  13130. *
  13131. * if not is_slice: # <<<<<<<<<<<<<<
  13132. *
  13133. * if start < 0:
  13134. */
  13135. __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
  13136. if (__pyx_t_1) {
  13137. /* "View.MemoryView":829
  13138. * if not is_slice:
  13139. *
  13140. * if start < 0: # <<<<<<<<<<<<<<
  13141. * start += shape
  13142. * if not 0 <= start < shape:
  13143. */
  13144. __pyx_t_1 = ((__pyx_v_start < 0) != 0);
  13145. if (__pyx_t_1) {
  13146. /* "View.MemoryView":830
  13147. *
  13148. * if start < 0:
  13149. * start += shape # <<<<<<<<<<<<<<
  13150. * if not 0 <= start < shape:
  13151. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  13152. */
  13153. __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
  13154. /* "View.MemoryView":829
  13155. * if not is_slice:
  13156. *
  13157. * if start < 0: # <<<<<<<<<<<<<<
  13158. * start += shape
  13159. * if not 0 <= start < shape:
  13160. */
  13161. }
  13162. /* "View.MemoryView":831
  13163. * if start < 0:
  13164. * start += shape
  13165. * if not 0 <= start < shape: # <<<<<<<<<<<<<<
  13166. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  13167. * else:
  13168. */
  13169. __pyx_t_1 = (0 <= __pyx_v_start);
  13170. if (__pyx_t_1) {
  13171. __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
  13172. }
  13173. __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
  13174. if (__pyx_t_2) {
  13175. /* "View.MemoryView":832
  13176. * start += shape
  13177. * if not 0 <= start < shape:
  13178. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim) # <<<<<<<<<<<<<<
  13179. * else:
  13180. *
  13181. */
  13182. __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(2, 832, __pyx_L1_error)
  13183. /* "View.MemoryView":831
  13184. * if start < 0:
  13185. * start += shape
  13186. * if not 0 <= start < shape: # <<<<<<<<<<<<<<
  13187. * _err_dim(IndexError, "Index out of bounds (axis %d)", dim)
  13188. * else:
  13189. */
  13190. }
  13191. /* "View.MemoryView":827
  13192. * cdef bint negative_step
  13193. *
  13194. * if not is_slice: # <<<<<<<<<<<<<<
  13195. *
  13196. * if start < 0:
  13197. */
  13198. goto __pyx_L3;
  13199. }
  13200. /* "View.MemoryView":835
  13201. * else:
  13202. *
  13203. * negative_step = have_step != 0 and step < 0 # <<<<<<<<<<<<<<
  13204. *
  13205. * if have_step and step == 0:
  13206. */
  13207. /*else*/ {
  13208. __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
  13209. if (__pyx_t_1) {
  13210. } else {
  13211. __pyx_t_2 = __pyx_t_1;
  13212. goto __pyx_L6_bool_binop_done;
  13213. }
  13214. __pyx_t_1 = ((__pyx_v_step < 0) != 0);
  13215. __pyx_t_2 = __pyx_t_1;
  13216. __pyx_L6_bool_binop_done:;
  13217. __pyx_v_negative_step = __pyx_t_2;
  13218. /* "View.MemoryView":837
  13219. * negative_step = have_step != 0 and step < 0
  13220. *
  13221. * if have_step and step == 0: # <<<<<<<<<<<<<<
  13222. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  13223. *
  13224. */
  13225. __pyx_t_1 = (__pyx_v_have_step != 0);
  13226. if (__pyx_t_1) {
  13227. } else {
  13228. __pyx_t_2 = __pyx_t_1;
  13229. goto __pyx_L9_bool_binop_done;
  13230. }
  13231. __pyx_t_1 = ((__pyx_v_step == 0) != 0);
  13232. __pyx_t_2 = __pyx_t_1;
  13233. __pyx_L9_bool_binop_done:;
  13234. if (__pyx_t_2) {
  13235. /* "View.MemoryView":838
  13236. *
  13237. * if have_step and step == 0:
  13238. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim) # <<<<<<<<<<<<<<
  13239. *
  13240. *
  13241. */
  13242. __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(2, 838, __pyx_L1_error)
  13243. /* "View.MemoryView":837
  13244. * negative_step = have_step != 0 and step < 0
  13245. *
  13246. * if have_step and step == 0: # <<<<<<<<<<<<<<
  13247. * _err_dim(ValueError, "Step may not be zero (axis %d)", dim)
  13248. *
  13249. */
  13250. }
  13251. /* "View.MemoryView":841
  13252. *
  13253. *
  13254. * if have_start: # <<<<<<<<<<<<<<
  13255. * if start < 0:
  13256. * start += shape
  13257. */
  13258. __pyx_t_2 = (__pyx_v_have_start != 0);
  13259. if (__pyx_t_2) {
  13260. /* "View.MemoryView":842
  13261. *
  13262. * if have_start:
  13263. * if start < 0: # <<<<<<<<<<<<<<
  13264. * start += shape
  13265. * if start < 0:
  13266. */
  13267. __pyx_t_2 = ((__pyx_v_start < 0) != 0);
  13268. if (__pyx_t_2) {
  13269. /* "View.MemoryView":843
  13270. * if have_start:
  13271. * if start < 0:
  13272. * start += shape # <<<<<<<<<<<<<<
  13273. * if start < 0:
  13274. * start = 0
  13275. */
  13276. __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
  13277. /* "View.MemoryView":844
  13278. * if start < 0:
  13279. * start += shape
  13280. * if start < 0: # <<<<<<<<<<<<<<
  13281. * start = 0
  13282. * elif start >= shape:
  13283. */
  13284. __pyx_t_2 = ((__pyx_v_start < 0) != 0);
  13285. if (__pyx_t_2) {
  13286. /* "View.MemoryView":845
  13287. * start += shape
  13288. * if start < 0:
  13289. * start = 0 # <<<<<<<<<<<<<<
  13290. * elif start >= shape:
  13291. * if negative_step:
  13292. */
  13293. __pyx_v_start = 0;
  13294. /* "View.MemoryView":844
  13295. * if start < 0:
  13296. * start += shape
  13297. * if start < 0: # <<<<<<<<<<<<<<
  13298. * start = 0
  13299. * elif start >= shape:
  13300. */
  13301. }
  13302. /* "View.MemoryView":842
  13303. *
  13304. * if have_start:
  13305. * if start < 0: # <<<<<<<<<<<<<<
  13306. * start += shape
  13307. * if start < 0:
  13308. */
  13309. goto __pyx_L12;
  13310. }
  13311. /* "View.MemoryView":846
  13312. * if start < 0:
  13313. * start = 0
  13314. * elif start >= shape: # <<<<<<<<<<<<<<
  13315. * if negative_step:
  13316. * start = shape - 1
  13317. */
  13318. __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
  13319. if (__pyx_t_2) {
  13320. /* "View.MemoryView":847
  13321. * start = 0
  13322. * elif start >= shape:
  13323. * if negative_step: # <<<<<<<<<<<<<<
  13324. * start = shape - 1
  13325. * else:
  13326. */
  13327. __pyx_t_2 = (__pyx_v_negative_step != 0);
  13328. if (__pyx_t_2) {
  13329. /* "View.MemoryView":848
  13330. * elif start >= shape:
  13331. * if negative_step:
  13332. * start = shape - 1 # <<<<<<<<<<<<<<
  13333. * else:
  13334. * start = shape
  13335. */
  13336. __pyx_v_start = (__pyx_v_shape - 1);
  13337. /* "View.MemoryView":847
  13338. * start = 0
  13339. * elif start >= shape:
  13340. * if negative_step: # <<<<<<<<<<<<<<
  13341. * start = shape - 1
  13342. * else:
  13343. */
  13344. goto __pyx_L14;
  13345. }
  13346. /* "View.MemoryView":850
  13347. * start = shape - 1
  13348. * else:
  13349. * start = shape # <<<<<<<<<<<<<<
  13350. * else:
  13351. * if negative_step:
  13352. */
  13353. /*else*/ {
  13354. __pyx_v_start = __pyx_v_shape;
  13355. }
  13356. __pyx_L14:;
  13357. /* "View.MemoryView":846
  13358. * if start < 0:
  13359. * start = 0
  13360. * elif start >= shape: # <<<<<<<<<<<<<<
  13361. * if negative_step:
  13362. * start = shape - 1
  13363. */
  13364. }
  13365. __pyx_L12:;
  13366. /* "View.MemoryView":841
  13367. *
  13368. *
  13369. * if have_start: # <<<<<<<<<<<<<<
  13370. * if start < 0:
  13371. * start += shape
  13372. */
  13373. goto __pyx_L11;
  13374. }
  13375. /* "View.MemoryView":852
  13376. * start = shape
  13377. * else:
  13378. * if negative_step: # <<<<<<<<<<<<<<
  13379. * start = shape - 1
  13380. * else:
  13381. */
  13382. /*else*/ {
  13383. __pyx_t_2 = (__pyx_v_negative_step != 0);
  13384. if (__pyx_t_2) {
  13385. /* "View.MemoryView":853
  13386. * else:
  13387. * if negative_step:
  13388. * start = shape - 1 # <<<<<<<<<<<<<<
  13389. * else:
  13390. * start = 0
  13391. */
  13392. __pyx_v_start = (__pyx_v_shape - 1);
  13393. /* "View.MemoryView":852
  13394. * start = shape
  13395. * else:
  13396. * if negative_step: # <<<<<<<<<<<<<<
  13397. * start = shape - 1
  13398. * else:
  13399. */
  13400. goto __pyx_L15;
  13401. }
  13402. /* "View.MemoryView":855
  13403. * start = shape - 1
  13404. * else:
  13405. * start = 0 # <<<<<<<<<<<<<<
  13406. *
  13407. * if have_stop:
  13408. */
  13409. /*else*/ {
  13410. __pyx_v_start = 0;
  13411. }
  13412. __pyx_L15:;
  13413. }
  13414. __pyx_L11:;
  13415. /* "View.MemoryView":857
  13416. * start = 0
  13417. *
  13418. * if have_stop: # <<<<<<<<<<<<<<
  13419. * if stop < 0:
  13420. * stop += shape
  13421. */
  13422. __pyx_t_2 = (__pyx_v_have_stop != 0);
  13423. if (__pyx_t_2) {
  13424. /* "View.MemoryView":858
  13425. *
  13426. * if have_stop:
  13427. * if stop < 0: # <<<<<<<<<<<<<<
  13428. * stop += shape
  13429. * if stop < 0:
  13430. */
  13431. __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
  13432. if (__pyx_t_2) {
  13433. /* "View.MemoryView":859
  13434. * if have_stop:
  13435. * if stop < 0:
  13436. * stop += shape # <<<<<<<<<<<<<<
  13437. * if stop < 0:
  13438. * stop = 0
  13439. */
  13440. __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
  13441. /* "View.MemoryView":860
  13442. * if stop < 0:
  13443. * stop += shape
  13444. * if stop < 0: # <<<<<<<<<<<<<<
  13445. * stop = 0
  13446. * elif stop > shape:
  13447. */
  13448. __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
  13449. if (__pyx_t_2) {
  13450. /* "View.MemoryView":861
  13451. * stop += shape
  13452. * if stop < 0:
  13453. * stop = 0 # <<<<<<<<<<<<<<
  13454. * elif stop > shape:
  13455. * stop = shape
  13456. */
  13457. __pyx_v_stop = 0;
  13458. /* "View.MemoryView":860
  13459. * if stop < 0:
  13460. * stop += shape
  13461. * if stop < 0: # <<<<<<<<<<<<<<
  13462. * stop = 0
  13463. * elif stop > shape:
  13464. */
  13465. }
  13466. /* "View.MemoryView":858
  13467. *
  13468. * if have_stop:
  13469. * if stop < 0: # <<<<<<<<<<<<<<
  13470. * stop += shape
  13471. * if stop < 0:
  13472. */
  13473. goto __pyx_L17;
  13474. }
  13475. /* "View.MemoryView":862
  13476. * if stop < 0:
  13477. * stop = 0
  13478. * elif stop > shape: # <<<<<<<<<<<<<<
  13479. * stop = shape
  13480. * else:
  13481. */
  13482. __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
  13483. if (__pyx_t_2) {
  13484. /* "View.MemoryView":863
  13485. * stop = 0
  13486. * elif stop > shape:
  13487. * stop = shape # <<<<<<<<<<<<<<
  13488. * else:
  13489. * if negative_step:
  13490. */
  13491. __pyx_v_stop = __pyx_v_shape;
  13492. /* "View.MemoryView":862
  13493. * if stop < 0:
  13494. * stop = 0
  13495. * elif stop > shape: # <<<<<<<<<<<<<<
  13496. * stop = shape
  13497. * else:
  13498. */
  13499. }
  13500. __pyx_L17:;
  13501. /* "View.MemoryView":857
  13502. * start = 0
  13503. *
  13504. * if have_stop: # <<<<<<<<<<<<<<
  13505. * if stop < 0:
  13506. * stop += shape
  13507. */
  13508. goto __pyx_L16;
  13509. }
  13510. /* "View.MemoryView":865
  13511. * stop = shape
  13512. * else:
  13513. * if negative_step: # <<<<<<<<<<<<<<
  13514. * stop = -1
  13515. * else:
  13516. */
  13517. /*else*/ {
  13518. __pyx_t_2 = (__pyx_v_negative_step != 0);
  13519. if (__pyx_t_2) {
  13520. /* "View.MemoryView":866
  13521. * else:
  13522. * if negative_step:
  13523. * stop = -1 # <<<<<<<<<<<<<<
  13524. * else:
  13525. * stop = shape
  13526. */
  13527. __pyx_v_stop = -1L;
  13528. /* "View.MemoryView":865
  13529. * stop = shape
  13530. * else:
  13531. * if negative_step: # <<<<<<<<<<<<<<
  13532. * stop = -1
  13533. * else:
  13534. */
  13535. goto __pyx_L19;
  13536. }
  13537. /* "View.MemoryView":868
  13538. * stop = -1
  13539. * else:
  13540. * stop = shape # <<<<<<<<<<<<<<
  13541. *
  13542. * if not have_step:
  13543. */
  13544. /*else*/ {
  13545. __pyx_v_stop = __pyx_v_shape;
  13546. }
  13547. __pyx_L19:;
  13548. }
  13549. __pyx_L16:;
  13550. /* "View.MemoryView":870
  13551. * stop = shape
  13552. *
  13553. * if not have_step: # <<<<<<<<<<<<<<
  13554. * step = 1
  13555. *
  13556. */
  13557. __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
  13558. if (__pyx_t_2) {
  13559. /* "View.MemoryView":871
  13560. *
  13561. * if not have_step:
  13562. * step = 1 # <<<<<<<<<<<<<<
  13563. *
  13564. *
  13565. */
  13566. __pyx_v_step = 1;
  13567. /* "View.MemoryView":870
  13568. * stop = shape
  13569. *
  13570. * if not have_step: # <<<<<<<<<<<<<<
  13571. * step = 1
  13572. *
  13573. */
  13574. }
  13575. /* "View.MemoryView":875
  13576. *
  13577. * with cython.cdivision(True):
  13578. * new_shape = (stop - start) // step # <<<<<<<<<<<<<<
  13579. *
  13580. * if (stop - start) - step * new_shape:
  13581. */
  13582. __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
  13583. /* "View.MemoryView":877
  13584. * new_shape = (stop - start) // step
  13585. *
  13586. * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
  13587. * new_shape += 1
  13588. *
  13589. */
  13590. __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
  13591. if (__pyx_t_2) {
  13592. /* "View.MemoryView":878
  13593. *
  13594. * if (stop - start) - step * new_shape:
  13595. * new_shape += 1 # <<<<<<<<<<<<<<
  13596. *
  13597. * if new_shape < 0:
  13598. */
  13599. __pyx_v_new_shape = (__pyx_v_new_shape + 1);
  13600. /* "View.MemoryView":877
  13601. * new_shape = (stop - start) // step
  13602. *
  13603. * if (stop - start) - step * new_shape: # <<<<<<<<<<<<<<
  13604. * new_shape += 1
  13605. *
  13606. */
  13607. }
  13608. /* "View.MemoryView":880
  13609. * new_shape += 1
  13610. *
  13611. * if new_shape < 0: # <<<<<<<<<<<<<<
  13612. * new_shape = 0
  13613. *
  13614. */
  13615. __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
  13616. if (__pyx_t_2) {
  13617. /* "View.MemoryView":881
  13618. *
  13619. * if new_shape < 0:
  13620. * new_shape = 0 # <<<<<<<<<<<<<<
  13621. *
  13622. *
  13623. */
  13624. __pyx_v_new_shape = 0;
  13625. /* "View.MemoryView":880
  13626. * new_shape += 1
  13627. *
  13628. * if new_shape < 0: # <<<<<<<<<<<<<<
  13629. * new_shape = 0
  13630. *
  13631. */
  13632. }
  13633. /* "View.MemoryView":884
  13634. *
  13635. *
  13636. * dst.strides[new_ndim] = stride * step # <<<<<<<<<<<<<<
  13637. * dst.shape[new_ndim] = new_shape
  13638. * dst.suboffsets[new_ndim] = suboffset
  13639. */
  13640. (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
  13641. /* "View.MemoryView":885
  13642. *
  13643. * dst.strides[new_ndim] = stride * step
  13644. * dst.shape[new_ndim] = new_shape # <<<<<<<<<<<<<<
  13645. * dst.suboffsets[new_ndim] = suboffset
  13646. *
  13647. */
  13648. (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
  13649. /* "View.MemoryView":886
  13650. * dst.strides[new_ndim] = stride * step
  13651. * dst.shape[new_ndim] = new_shape
  13652. * dst.suboffsets[new_ndim] = suboffset # <<<<<<<<<<<<<<
  13653. *
  13654. *
  13655. */
  13656. (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
  13657. }
  13658. __pyx_L3:;
  13659. /* "View.MemoryView":889
  13660. *
  13661. *
  13662. * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
  13663. * dst.data += start * stride
  13664. * else:
  13665. */
  13666. __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
  13667. if (__pyx_t_2) {
  13668. /* "View.MemoryView":890
  13669. *
  13670. * if suboffset_dim[0] < 0:
  13671. * dst.data += start * stride # <<<<<<<<<<<<<<
  13672. * else:
  13673. * dst.suboffsets[suboffset_dim[0]] += start * stride
  13674. */
  13675. __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
  13676. /* "View.MemoryView":889
  13677. *
  13678. *
  13679. * if suboffset_dim[0] < 0: # <<<<<<<<<<<<<<
  13680. * dst.data += start * stride
  13681. * else:
  13682. */
  13683. goto __pyx_L23;
  13684. }
  13685. /* "View.MemoryView":892
  13686. * dst.data += start * stride
  13687. * else:
  13688. * dst.suboffsets[suboffset_dim[0]] += start * stride # <<<<<<<<<<<<<<
  13689. *
  13690. * if suboffset >= 0:
  13691. */
  13692. /*else*/ {
  13693. __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
  13694. (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
  13695. }
  13696. __pyx_L23:;
  13697. /* "View.MemoryView":894
  13698. * dst.suboffsets[suboffset_dim[0]] += start * stride
  13699. *
  13700. * if suboffset >= 0: # <<<<<<<<<<<<<<
  13701. * if not is_slice:
  13702. * if new_ndim == 0:
  13703. */
  13704. __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  13705. if (__pyx_t_2) {
  13706. /* "View.MemoryView":895
  13707. *
  13708. * if suboffset >= 0:
  13709. * if not is_slice: # <<<<<<<<<<<<<<
  13710. * if new_ndim == 0:
  13711. * dst.data = (<char **> dst.data)[0] + suboffset
  13712. */
  13713. __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
  13714. if (__pyx_t_2) {
  13715. /* "View.MemoryView":896
  13716. * if suboffset >= 0:
  13717. * if not is_slice:
  13718. * if new_ndim == 0: # <<<<<<<<<<<<<<
  13719. * dst.data = (<char **> dst.data)[0] + suboffset
  13720. * else:
  13721. */
  13722. __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
  13723. if (__pyx_t_2) {
  13724. /* "View.MemoryView":897
  13725. * if not is_slice:
  13726. * if new_ndim == 0:
  13727. * dst.data = (<char **> dst.data)[0] + suboffset # <<<<<<<<<<<<<<
  13728. * else:
  13729. * _err_dim(IndexError, "All dimensions preceding dimension %d "
  13730. */
  13731. __pyx_v_dst->data = ((((char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
  13732. /* "View.MemoryView":896
  13733. * if suboffset >= 0:
  13734. * if not is_slice:
  13735. * if new_ndim == 0: # <<<<<<<<<<<<<<
  13736. * dst.data = (<char **> dst.data)[0] + suboffset
  13737. * else:
  13738. */
  13739. goto __pyx_L26;
  13740. }
  13741. /* "View.MemoryView":899
  13742. * dst.data = (<char **> dst.data)[0] + suboffset
  13743. * else:
  13744. * _err_dim(IndexError, "All dimensions preceding dimension %d " # <<<<<<<<<<<<<<
  13745. * "must be indexed and not sliced", dim)
  13746. * else:
  13747. */
  13748. /*else*/ {
  13749. /* "View.MemoryView":900
  13750. * else:
  13751. * _err_dim(IndexError, "All dimensions preceding dimension %d "
  13752. * "must be indexed and not sliced", dim) # <<<<<<<<<<<<<<
  13753. * else:
  13754. * suboffset_dim[0] = new_ndim
  13755. */
  13756. __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(2, 899, __pyx_L1_error)
  13757. }
  13758. __pyx_L26:;
  13759. /* "View.MemoryView":895
  13760. *
  13761. * if suboffset >= 0:
  13762. * if not is_slice: # <<<<<<<<<<<<<<
  13763. * if new_ndim == 0:
  13764. * dst.data = (<char **> dst.data)[0] + suboffset
  13765. */
  13766. goto __pyx_L25;
  13767. }
  13768. /* "View.MemoryView":902
  13769. * "must be indexed and not sliced", dim)
  13770. * else:
  13771. * suboffset_dim[0] = new_ndim # <<<<<<<<<<<<<<
  13772. *
  13773. * return 0
  13774. */
  13775. /*else*/ {
  13776. (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
  13777. }
  13778. __pyx_L25:;
  13779. /* "View.MemoryView":894
  13780. * dst.suboffsets[suboffset_dim[0]] += start * stride
  13781. *
  13782. * if suboffset >= 0: # <<<<<<<<<<<<<<
  13783. * if not is_slice:
  13784. * if new_ndim == 0:
  13785. */
  13786. }
  13787. /* "View.MemoryView":904
  13788. * suboffset_dim[0] = new_ndim
  13789. *
  13790. * return 0 # <<<<<<<<<<<<<<
  13791. *
  13792. *
  13793. */
  13794. __pyx_r = 0;
  13795. goto __pyx_L0;
  13796. /* "View.MemoryView":807
  13797. *
  13798. * @cname('__pyx_memoryview_slice_memviewslice')
  13799. * cdef int slice_memviewslice( # <<<<<<<<<<<<<<
  13800. * __Pyx_memviewslice *dst,
  13801. * Py_ssize_t shape, Py_ssize_t stride, Py_ssize_t suboffset,
  13802. */
  13803. /* function exit code */
  13804. __pyx_L1_error:;
  13805. {
  13806. #ifdef WITH_THREAD
  13807. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  13808. #endif
  13809. __Pyx_AddTraceback("View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  13810. #ifdef WITH_THREAD
  13811. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  13812. #endif
  13813. }
  13814. __pyx_r = -1;
  13815. __pyx_L0:;
  13816. return __pyx_r;
  13817. }
  13818. /* "View.MemoryView":910
  13819. *
  13820. * @cname('__pyx_pybuffer_index')
  13821. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
  13822. * Py_ssize_t dim) except NULL:
  13823. * cdef Py_ssize_t shape, stride, suboffset = -1
  13824. */
  13825. 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) {
  13826. Py_ssize_t __pyx_v_shape;
  13827. Py_ssize_t __pyx_v_stride;
  13828. Py_ssize_t __pyx_v_suboffset;
  13829. Py_ssize_t __pyx_v_itemsize;
  13830. char *__pyx_v_resultp;
  13831. char *__pyx_r;
  13832. __Pyx_RefNannyDeclarations
  13833. Py_ssize_t __pyx_t_1;
  13834. int __pyx_t_2;
  13835. PyObject *__pyx_t_3 = NULL;
  13836. PyObject *__pyx_t_4 = NULL;
  13837. __Pyx_RefNannySetupContext("pybuffer_index", 0);
  13838. /* "View.MemoryView":912
  13839. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
  13840. * Py_ssize_t dim) except NULL:
  13841. * cdef Py_ssize_t shape, stride, suboffset = -1 # <<<<<<<<<<<<<<
  13842. * cdef Py_ssize_t itemsize = view.itemsize
  13843. * cdef char *resultp
  13844. */
  13845. __pyx_v_suboffset = -1L;
  13846. /* "View.MemoryView":913
  13847. * Py_ssize_t dim) except NULL:
  13848. * cdef Py_ssize_t shape, stride, suboffset = -1
  13849. * cdef Py_ssize_t itemsize = view.itemsize # <<<<<<<<<<<<<<
  13850. * cdef char *resultp
  13851. *
  13852. */
  13853. __pyx_t_1 = __pyx_v_view->itemsize;
  13854. __pyx_v_itemsize = __pyx_t_1;
  13855. /* "View.MemoryView":916
  13856. * cdef char *resultp
  13857. *
  13858. * if view.ndim == 0: # <<<<<<<<<<<<<<
  13859. * shape = view.len / itemsize
  13860. * stride = itemsize
  13861. */
  13862. __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
  13863. if (__pyx_t_2) {
  13864. /* "View.MemoryView":917
  13865. *
  13866. * if view.ndim == 0:
  13867. * shape = view.len / itemsize # <<<<<<<<<<<<<<
  13868. * stride = itemsize
  13869. * else:
  13870. */
  13871. if (unlikely(__pyx_v_itemsize == 0)) {
  13872. PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
  13873. __PYX_ERR(2, 917, __pyx_L1_error)
  13874. }
  13875. 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))) {
  13876. PyErr_SetString(PyExc_OverflowError, "value too large to perform division");
  13877. __PYX_ERR(2, 917, __pyx_L1_error)
  13878. }
  13879. __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
  13880. /* "View.MemoryView":918
  13881. * if view.ndim == 0:
  13882. * shape = view.len / itemsize
  13883. * stride = itemsize # <<<<<<<<<<<<<<
  13884. * else:
  13885. * shape = view.shape[dim]
  13886. */
  13887. __pyx_v_stride = __pyx_v_itemsize;
  13888. /* "View.MemoryView":916
  13889. * cdef char *resultp
  13890. *
  13891. * if view.ndim == 0: # <<<<<<<<<<<<<<
  13892. * shape = view.len / itemsize
  13893. * stride = itemsize
  13894. */
  13895. goto __pyx_L3;
  13896. }
  13897. /* "View.MemoryView":920
  13898. * stride = itemsize
  13899. * else:
  13900. * shape = view.shape[dim] # <<<<<<<<<<<<<<
  13901. * stride = view.strides[dim]
  13902. * if view.suboffsets != NULL:
  13903. */
  13904. /*else*/ {
  13905. __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
  13906. /* "View.MemoryView":921
  13907. * else:
  13908. * shape = view.shape[dim]
  13909. * stride = view.strides[dim] # <<<<<<<<<<<<<<
  13910. * if view.suboffsets != NULL:
  13911. * suboffset = view.suboffsets[dim]
  13912. */
  13913. __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
  13914. /* "View.MemoryView":922
  13915. * shape = view.shape[dim]
  13916. * stride = view.strides[dim]
  13917. * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
  13918. * suboffset = view.suboffsets[dim]
  13919. *
  13920. */
  13921. __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
  13922. if (__pyx_t_2) {
  13923. /* "View.MemoryView":923
  13924. * stride = view.strides[dim]
  13925. * if view.suboffsets != NULL:
  13926. * suboffset = view.suboffsets[dim] # <<<<<<<<<<<<<<
  13927. *
  13928. * if index < 0:
  13929. */
  13930. __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
  13931. /* "View.MemoryView":922
  13932. * shape = view.shape[dim]
  13933. * stride = view.strides[dim]
  13934. * if view.suboffsets != NULL: # <<<<<<<<<<<<<<
  13935. * suboffset = view.suboffsets[dim]
  13936. *
  13937. */
  13938. }
  13939. }
  13940. __pyx_L3:;
  13941. /* "View.MemoryView":925
  13942. * suboffset = view.suboffsets[dim]
  13943. *
  13944. * if index < 0: # <<<<<<<<<<<<<<
  13945. * index += view.shape[dim]
  13946. * if index < 0:
  13947. */
  13948. __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  13949. if (__pyx_t_2) {
  13950. /* "View.MemoryView":926
  13951. *
  13952. * if index < 0:
  13953. * index += view.shape[dim] # <<<<<<<<<<<<<<
  13954. * if index < 0:
  13955. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  13956. */
  13957. __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
  13958. /* "View.MemoryView":927
  13959. * if index < 0:
  13960. * index += view.shape[dim]
  13961. * if index < 0: # <<<<<<<<<<<<<<
  13962. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  13963. *
  13964. */
  13965. __pyx_t_2 = ((__pyx_v_index < 0) != 0);
  13966. if (unlikely(__pyx_t_2)) {
  13967. /* "View.MemoryView":928
  13968. * index += view.shape[dim]
  13969. * if index < 0:
  13970. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
  13971. *
  13972. * if index >= shape:
  13973. */
  13974. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
  13975. __Pyx_GOTREF(__pyx_t_3);
  13976. __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(2, 928, __pyx_L1_error)
  13977. __Pyx_GOTREF(__pyx_t_4);
  13978. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13979. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 928, __pyx_L1_error)
  13980. __Pyx_GOTREF(__pyx_t_3);
  13981. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  13982. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  13983. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  13984. __PYX_ERR(2, 928, __pyx_L1_error)
  13985. /* "View.MemoryView":927
  13986. * if index < 0:
  13987. * index += view.shape[dim]
  13988. * if index < 0: # <<<<<<<<<<<<<<
  13989. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  13990. *
  13991. */
  13992. }
  13993. /* "View.MemoryView":925
  13994. * suboffset = view.suboffsets[dim]
  13995. *
  13996. * if index < 0: # <<<<<<<<<<<<<<
  13997. * index += view.shape[dim]
  13998. * if index < 0:
  13999. */
  14000. }
  14001. /* "View.MemoryView":930
  14002. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  14003. *
  14004. * if index >= shape: # <<<<<<<<<<<<<<
  14005. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  14006. *
  14007. */
  14008. __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
  14009. if (unlikely(__pyx_t_2)) {
  14010. /* "View.MemoryView":931
  14011. *
  14012. * if index >= shape:
  14013. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim) # <<<<<<<<<<<<<<
  14014. *
  14015. * resultp = bufp + index * stride
  14016. */
  14017. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
  14018. __Pyx_GOTREF(__pyx_t_3);
  14019. __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(2, 931, __pyx_L1_error)
  14020. __Pyx_GOTREF(__pyx_t_4);
  14021. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14022. __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 931, __pyx_L1_error)
  14023. __Pyx_GOTREF(__pyx_t_3);
  14024. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  14025. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  14026. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14027. __PYX_ERR(2, 931, __pyx_L1_error)
  14028. /* "View.MemoryView":930
  14029. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  14030. *
  14031. * if index >= shape: # <<<<<<<<<<<<<<
  14032. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  14033. *
  14034. */
  14035. }
  14036. /* "View.MemoryView":933
  14037. * raise IndexError("Out of bounds on buffer access (axis %d)" % dim)
  14038. *
  14039. * resultp = bufp + index * stride # <<<<<<<<<<<<<<
  14040. * if suboffset >= 0:
  14041. * resultp = (<char **> resultp)[0] + suboffset
  14042. */
  14043. __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
  14044. /* "View.MemoryView":934
  14045. *
  14046. * resultp = bufp + index * stride
  14047. * if suboffset >= 0: # <<<<<<<<<<<<<<
  14048. * resultp = (<char **> resultp)[0] + suboffset
  14049. *
  14050. */
  14051. __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
  14052. if (__pyx_t_2) {
  14053. /* "View.MemoryView":935
  14054. * resultp = bufp + index * stride
  14055. * if suboffset >= 0:
  14056. * resultp = (<char **> resultp)[0] + suboffset # <<<<<<<<<<<<<<
  14057. *
  14058. * return resultp
  14059. */
  14060. __pyx_v_resultp = ((((char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
  14061. /* "View.MemoryView":934
  14062. *
  14063. * resultp = bufp + index * stride
  14064. * if suboffset >= 0: # <<<<<<<<<<<<<<
  14065. * resultp = (<char **> resultp)[0] + suboffset
  14066. *
  14067. */
  14068. }
  14069. /* "View.MemoryView":937
  14070. * resultp = (<char **> resultp)[0] + suboffset
  14071. *
  14072. * return resultp # <<<<<<<<<<<<<<
  14073. *
  14074. *
  14075. */
  14076. __pyx_r = __pyx_v_resultp;
  14077. goto __pyx_L0;
  14078. /* "View.MemoryView":910
  14079. *
  14080. * @cname('__pyx_pybuffer_index')
  14081. * cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index, # <<<<<<<<<<<<<<
  14082. * Py_ssize_t dim) except NULL:
  14083. * cdef Py_ssize_t shape, stride, suboffset = -1
  14084. */
  14085. /* function exit code */
  14086. __pyx_L1_error:;
  14087. __Pyx_XDECREF(__pyx_t_3);
  14088. __Pyx_XDECREF(__pyx_t_4);
  14089. __Pyx_AddTraceback("View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14090. __pyx_r = NULL;
  14091. __pyx_L0:;
  14092. __Pyx_RefNannyFinishContext();
  14093. return __pyx_r;
  14094. }
  14095. /* "View.MemoryView":943
  14096. *
  14097. * @cname('__pyx_memslice_transpose')
  14098. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
  14099. * cdef int ndim = memslice.memview.view.ndim
  14100. *
  14101. */
  14102. static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
  14103. int __pyx_v_ndim;
  14104. Py_ssize_t *__pyx_v_shape;
  14105. Py_ssize_t *__pyx_v_strides;
  14106. int __pyx_v_i;
  14107. int __pyx_v_j;
  14108. int __pyx_r;
  14109. int __pyx_t_1;
  14110. Py_ssize_t *__pyx_t_2;
  14111. long __pyx_t_3;
  14112. long __pyx_t_4;
  14113. Py_ssize_t __pyx_t_5;
  14114. Py_ssize_t __pyx_t_6;
  14115. int __pyx_t_7;
  14116. int __pyx_t_8;
  14117. int __pyx_t_9;
  14118. /* "View.MemoryView":944
  14119. * @cname('__pyx_memslice_transpose')
  14120. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0:
  14121. * cdef int ndim = memslice.memview.view.ndim # <<<<<<<<<<<<<<
  14122. *
  14123. * cdef Py_ssize_t *shape = memslice.shape
  14124. */
  14125. __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
  14126. __pyx_v_ndim = __pyx_t_1;
  14127. /* "View.MemoryView":946
  14128. * cdef int ndim = memslice.memview.view.ndim
  14129. *
  14130. * cdef Py_ssize_t *shape = memslice.shape # <<<<<<<<<<<<<<
  14131. * cdef Py_ssize_t *strides = memslice.strides
  14132. *
  14133. */
  14134. __pyx_t_2 = __pyx_v_memslice->shape;
  14135. __pyx_v_shape = __pyx_t_2;
  14136. /* "View.MemoryView":947
  14137. *
  14138. * cdef Py_ssize_t *shape = memslice.shape
  14139. * cdef Py_ssize_t *strides = memslice.strides # <<<<<<<<<<<<<<
  14140. *
  14141. *
  14142. */
  14143. __pyx_t_2 = __pyx_v_memslice->strides;
  14144. __pyx_v_strides = __pyx_t_2;
  14145. /* "View.MemoryView":951
  14146. *
  14147. * cdef int i, j
  14148. * for i in range(ndim / 2): # <<<<<<<<<<<<<<
  14149. * j = ndim - 1 - i
  14150. * strides[i], strides[j] = strides[j], strides[i]
  14151. */
  14152. __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
  14153. __pyx_t_4 = __pyx_t_3;
  14154. for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
  14155. __pyx_v_i = __pyx_t_1;
  14156. /* "View.MemoryView":952
  14157. * cdef int i, j
  14158. * for i in range(ndim / 2):
  14159. * j = ndim - 1 - i # <<<<<<<<<<<<<<
  14160. * strides[i], strides[j] = strides[j], strides[i]
  14161. * shape[i], shape[j] = shape[j], shape[i]
  14162. */
  14163. __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
  14164. /* "View.MemoryView":953
  14165. * for i in range(ndim / 2):
  14166. * j = ndim - 1 - i
  14167. * strides[i], strides[j] = strides[j], strides[i] # <<<<<<<<<<<<<<
  14168. * shape[i], shape[j] = shape[j], shape[i]
  14169. *
  14170. */
  14171. __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
  14172. __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
  14173. (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
  14174. (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
  14175. /* "View.MemoryView":954
  14176. * j = ndim - 1 - i
  14177. * strides[i], strides[j] = strides[j], strides[i]
  14178. * shape[i], shape[j] = shape[j], shape[i] # <<<<<<<<<<<<<<
  14179. *
  14180. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  14181. */
  14182. __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
  14183. __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
  14184. (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
  14185. (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
  14186. /* "View.MemoryView":956
  14187. * shape[i], shape[j] = shape[j], shape[i]
  14188. *
  14189. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
  14190. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  14191. *
  14192. */
  14193. __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
  14194. if (!__pyx_t_8) {
  14195. } else {
  14196. __pyx_t_7 = __pyx_t_8;
  14197. goto __pyx_L6_bool_binop_done;
  14198. }
  14199. __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
  14200. __pyx_t_7 = __pyx_t_8;
  14201. __pyx_L6_bool_binop_done:;
  14202. if (__pyx_t_7) {
  14203. /* "View.MemoryView":957
  14204. *
  14205. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0:
  14206. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions") # <<<<<<<<<<<<<<
  14207. *
  14208. * return 1
  14209. */
  14210. __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(2, 957, __pyx_L1_error)
  14211. /* "View.MemoryView":956
  14212. * shape[i], shape[j] = shape[j], shape[i]
  14213. *
  14214. * if memslice.suboffsets[i] >= 0 or memslice.suboffsets[j] >= 0: # <<<<<<<<<<<<<<
  14215. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  14216. *
  14217. */
  14218. }
  14219. }
  14220. /* "View.MemoryView":959
  14221. * _err(ValueError, "Cannot transpose memoryview with indirect dimensions")
  14222. *
  14223. * return 1 # <<<<<<<<<<<<<<
  14224. *
  14225. *
  14226. */
  14227. __pyx_r = 1;
  14228. goto __pyx_L0;
  14229. /* "View.MemoryView":943
  14230. *
  14231. * @cname('__pyx_memslice_transpose')
  14232. * cdef int transpose_memslice(__Pyx_memviewslice *memslice) nogil except 0: # <<<<<<<<<<<<<<
  14233. * cdef int ndim = memslice.memview.view.ndim
  14234. *
  14235. */
  14236. /* function exit code */
  14237. __pyx_L1_error:;
  14238. {
  14239. #ifdef WITH_THREAD
  14240. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  14241. #endif
  14242. __Pyx_AddTraceback("View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14243. #ifdef WITH_THREAD
  14244. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  14245. #endif
  14246. }
  14247. __pyx_r = 0;
  14248. __pyx_L0:;
  14249. return __pyx_r;
  14250. }
  14251. /* "View.MemoryView":976
  14252. * cdef int (*to_dtype_func)(char *, object) except 0
  14253. *
  14254. * def __dealloc__(self): # <<<<<<<<<<<<<<
  14255. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  14256. *
  14257. */
  14258. /* Python wrapper */
  14259. static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self); /*proto*/
  14260. static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
  14261. __Pyx_RefNannyDeclarations
  14262. __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  14263. __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  14264. /* function exit code */
  14265. __Pyx_RefNannyFinishContext();
  14266. }
  14267. static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  14268. __Pyx_RefNannyDeclarations
  14269. __Pyx_RefNannySetupContext("__dealloc__", 0);
  14270. /* "View.MemoryView":977
  14271. *
  14272. * def __dealloc__(self):
  14273. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1) # <<<<<<<<<<<<<<
  14274. *
  14275. * cdef convert_item_to_object(self, char *itemp):
  14276. */
  14277. __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
  14278. /* "View.MemoryView":976
  14279. * cdef int (*to_dtype_func)(char *, object) except 0
  14280. *
  14281. * def __dealloc__(self): # <<<<<<<<<<<<<<
  14282. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  14283. *
  14284. */
  14285. /* function exit code */
  14286. __Pyx_RefNannyFinishContext();
  14287. }
  14288. /* "View.MemoryView":979
  14289. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  14290. *
  14291. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  14292. * if self.to_object_func != NULL:
  14293. * return self.to_object_func(itemp)
  14294. */
  14295. static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp) {
  14296. PyObject *__pyx_r = NULL;
  14297. __Pyx_RefNannyDeclarations
  14298. int __pyx_t_1;
  14299. PyObject *__pyx_t_2 = NULL;
  14300. __Pyx_RefNannySetupContext("convert_item_to_object", 0);
  14301. /* "View.MemoryView":980
  14302. *
  14303. * cdef convert_item_to_object(self, char *itemp):
  14304. * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
  14305. * return self.to_object_func(itemp)
  14306. * else:
  14307. */
  14308. __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
  14309. if (__pyx_t_1) {
  14310. /* "View.MemoryView":981
  14311. * cdef convert_item_to_object(self, char *itemp):
  14312. * if self.to_object_func != NULL:
  14313. * return self.to_object_func(itemp) # <<<<<<<<<<<<<<
  14314. * else:
  14315. * return memoryview.convert_item_to_object(self, itemp)
  14316. */
  14317. __Pyx_XDECREF(__pyx_r);
  14318. __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 981, __pyx_L1_error)
  14319. __Pyx_GOTREF(__pyx_t_2);
  14320. __pyx_r = __pyx_t_2;
  14321. __pyx_t_2 = 0;
  14322. goto __pyx_L0;
  14323. /* "View.MemoryView":980
  14324. *
  14325. * cdef convert_item_to_object(self, char *itemp):
  14326. * if self.to_object_func != NULL: # <<<<<<<<<<<<<<
  14327. * return self.to_object_func(itemp)
  14328. * else:
  14329. */
  14330. }
  14331. /* "View.MemoryView":983
  14332. * return self.to_object_func(itemp)
  14333. * else:
  14334. * return memoryview.convert_item_to_object(self, itemp) # <<<<<<<<<<<<<<
  14335. *
  14336. * cdef assign_item_from_object(self, char *itemp, object value):
  14337. */
  14338. /*else*/ {
  14339. __Pyx_XDECREF(__pyx_r);
  14340. __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(2, 983, __pyx_L1_error)
  14341. __Pyx_GOTREF(__pyx_t_2);
  14342. __pyx_r = __pyx_t_2;
  14343. __pyx_t_2 = 0;
  14344. goto __pyx_L0;
  14345. }
  14346. /* "View.MemoryView":979
  14347. * __PYX_XDEC_MEMVIEW(&self.from_slice, 1)
  14348. *
  14349. * cdef convert_item_to_object(self, char *itemp): # <<<<<<<<<<<<<<
  14350. * if self.to_object_func != NULL:
  14351. * return self.to_object_func(itemp)
  14352. */
  14353. /* function exit code */
  14354. __pyx_L1_error:;
  14355. __Pyx_XDECREF(__pyx_t_2);
  14356. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14357. __pyx_r = 0;
  14358. __pyx_L0:;
  14359. __Pyx_XGIVEREF(__pyx_r);
  14360. __Pyx_RefNannyFinishContext();
  14361. return __pyx_r;
  14362. }
  14363. /* "View.MemoryView":985
  14364. * return memoryview.convert_item_to_object(self, itemp)
  14365. *
  14366. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  14367. * if self.to_dtype_func != NULL:
  14368. * self.to_dtype_func(itemp, value)
  14369. */
  14370. static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memoryviewslice_obj *__pyx_v_self, char *__pyx_v_itemp, PyObject *__pyx_v_value) {
  14371. PyObject *__pyx_r = NULL;
  14372. __Pyx_RefNannyDeclarations
  14373. int __pyx_t_1;
  14374. int __pyx_t_2;
  14375. PyObject *__pyx_t_3 = NULL;
  14376. __Pyx_RefNannySetupContext("assign_item_from_object", 0);
  14377. /* "View.MemoryView":986
  14378. *
  14379. * cdef assign_item_from_object(self, char *itemp, object value):
  14380. * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
  14381. * self.to_dtype_func(itemp, value)
  14382. * else:
  14383. */
  14384. __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
  14385. if (__pyx_t_1) {
  14386. /* "View.MemoryView":987
  14387. * cdef assign_item_from_object(self, char *itemp, object value):
  14388. * if self.to_dtype_func != NULL:
  14389. * self.to_dtype_func(itemp, value) # <<<<<<<<<<<<<<
  14390. * else:
  14391. * memoryview.assign_item_from_object(self, itemp, value)
  14392. */
  14393. __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)0))) __PYX_ERR(2, 987, __pyx_L1_error)
  14394. /* "View.MemoryView":986
  14395. *
  14396. * cdef assign_item_from_object(self, char *itemp, object value):
  14397. * if self.to_dtype_func != NULL: # <<<<<<<<<<<<<<
  14398. * self.to_dtype_func(itemp, value)
  14399. * else:
  14400. */
  14401. goto __pyx_L3;
  14402. }
  14403. /* "View.MemoryView":989
  14404. * self.to_dtype_func(itemp, value)
  14405. * else:
  14406. * memoryview.assign_item_from_object(self, itemp, value) # <<<<<<<<<<<<<<
  14407. *
  14408. * @property
  14409. */
  14410. /*else*/ {
  14411. __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(2, 989, __pyx_L1_error)
  14412. __Pyx_GOTREF(__pyx_t_3);
  14413. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14414. }
  14415. __pyx_L3:;
  14416. /* "View.MemoryView":985
  14417. * return memoryview.convert_item_to_object(self, itemp)
  14418. *
  14419. * cdef assign_item_from_object(self, char *itemp, object value): # <<<<<<<<<<<<<<
  14420. * if self.to_dtype_func != NULL:
  14421. * self.to_dtype_func(itemp, value)
  14422. */
  14423. /* function exit code */
  14424. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  14425. goto __pyx_L0;
  14426. __pyx_L1_error:;
  14427. __Pyx_XDECREF(__pyx_t_3);
  14428. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14429. __pyx_r = 0;
  14430. __pyx_L0:;
  14431. __Pyx_XGIVEREF(__pyx_r);
  14432. __Pyx_RefNannyFinishContext();
  14433. return __pyx_r;
  14434. }
  14435. /* "View.MemoryView":992
  14436. *
  14437. * @property
  14438. * def base(self): # <<<<<<<<<<<<<<
  14439. * return self.from_object
  14440. *
  14441. */
  14442. /* Python wrapper */
  14443. static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self); /*proto*/
  14444. static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
  14445. PyObject *__pyx_r = 0;
  14446. __Pyx_RefNannyDeclarations
  14447. __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  14448. __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  14449. /* function exit code */
  14450. __Pyx_RefNannyFinishContext();
  14451. return __pyx_r;
  14452. }
  14453. static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  14454. PyObject *__pyx_r = NULL;
  14455. __Pyx_RefNannyDeclarations
  14456. __Pyx_RefNannySetupContext("__get__", 0);
  14457. /* "View.MemoryView":993
  14458. * @property
  14459. * def base(self):
  14460. * return self.from_object # <<<<<<<<<<<<<<
  14461. *
  14462. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)")
  14463. */
  14464. __Pyx_XDECREF(__pyx_r);
  14465. __Pyx_INCREF(__pyx_v_self->from_object);
  14466. __pyx_r = __pyx_v_self->from_object;
  14467. goto __pyx_L0;
  14468. /* "View.MemoryView":992
  14469. *
  14470. * @property
  14471. * def base(self): # <<<<<<<<<<<<<<
  14472. * return self.from_object
  14473. *
  14474. */
  14475. /* function exit code */
  14476. __pyx_L0:;
  14477. __Pyx_XGIVEREF(__pyx_r);
  14478. __Pyx_RefNannyFinishContext();
  14479. return __pyx_r;
  14480. }
  14481. /* "(tree fragment)":1
  14482. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  14483. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  14484. * def __setstate_cython__(self, __pyx_state):
  14485. */
  14486. /* Python wrapper */
  14487. static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
  14488. static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  14489. PyObject *__pyx_r = 0;
  14490. __Pyx_RefNannyDeclarations
  14491. __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  14492. __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self));
  14493. /* function exit code */
  14494. __Pyx_RefNannyFinishContext();
  14495. return __pyx_r;
  14496. }
  14497. static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED struct __pyx_memoryviewslice_obj *__pyx_v_self) {
  14498. PyObject *__pyx_r = NULL;
  14499. __Pyx_RefNannyDeclarations
  14500. PyObject *__pyx_t_1 = NULL;
  14501. __Pyx_RefNannySetupContext("__reduce_cython__", 0);
  14502. /* "(tree fragment)":2
  14503. * def __reduce_cython__(self):
  14504. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  14505. * def __setstate_cython__(self, __pyx_state):
  14506. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  14507. */
  14508. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
  14509. __Pyx_GOTREF(__pyx_t_1);
  14510. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  14511. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14512. __PYX_ERR(2, 2, __pyx_L1_error)
  14513. /* "(tree fragment)":1
  14514. * def __reduce_cython__(self): # <<<<<<<<<<<<<<
  14515. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  14516. * def __setstate_cython__(self, __pyx_state):
  14517. */
  14518. /* function exit code */
  14519. __pyx_L1_error:;
  14520. __Pyx_XDECREF(__pyx_t_1);
  14521. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14522. __pyx_r = NULL;
  14523. __Pyx_XGIVEREF(__pyx_r);
  14524. __Pyx_RefNannyFinishContext();
  14525. return __pyx_r;
  14526. }
  14527. /* "(tree fragment)":3
  14528. * def __reduce_cython__(self):
  14529. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  14530. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  14531. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  14532. */
  14533. /* Python wrapper */
  14534. static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
  14535. static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  14536. PyObject *__pyx_r = 0;
  14537. __Pyx_RefNannyDeclarations
  14538. __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  14539. __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
  14540. /* function exit code */
  14541. __Pyx_RefNannyFinishContext();
  14542. return __pyx_r;
  14543. }
  14544. 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) {
  14545. PyObject *__pyx_r = NULL;
  14546. __Pyx_RefNannyDeclarations
  14547. PyObject *__pyx_t_1 = NULL;
  14548. __Pyx_RefNannySetupContext("__setstate_cython__", 0);
  14549. /* "(tree fragment)":4
  14550. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  14551. * def __setstate_cython__(self, __pyx_state):
  14552. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  14553. */
  14554. __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
  14555. __Pyx_GOTREF(__pyx_t_1);
  14556. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  14557. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  14558. __PYX_ERR(2, 4, __pyx_L1_error)
  14559. /* "(tree fragment)":3
  14560. * def __reduce_cython__(self):
  14561. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  14562. * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
  14563. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  14564. */
  14565. /* function exit code */
  14566. __pyx_L1_error:;
  14567. __Pyx_XDECREF(__pyx_t_1);
  14568. __Pyx_AddTraceback("View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14569. __pyx_r = NULL;
  14570. __Pyx_XGIVEREF(__pyx_r);
  14571. __Pyx_RefNannyFinishContext();
  14572. return __pyx_r;
  14573. }
  14574. /* "View.MemoryView":999
  14575. *
  14576. * @cname('__pyx_memoryview_fromslice')
  14577. * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
  14578. * int ndim,
  14579. * object (*to_object_func)(char *),
  14580. */
  14581. 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) {
  14582. struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
  14583. Py_ssize_t __pyx_v_suboffset;
  14584. PyObject *__pyx_v_length = NULL;
  14585. PyObject *__pyx_r = NULL;
  14586. __Pyx_RefNannyDeclarations
  14587. int __pyx_t_1;
  14588. PyObject *__pyx_t_2 = NULL;
  14589. PyObject *__pyx_t_3 = NULL;
  14590. __Pyx_TypeInfo *__pyx_t_4;
  14591. Py_buffer __pyx_t_5;
  14592. Py_ssize_t *__pyx_t_6;
  14593. Py_ssize_t *__pyx_t_7;
  14594. Py_ssize_t *__pyx_t_8;
  14595. Py_ssize_t __pyx_t_9;
  14596. __Pyx_RefNannySetupContext("memoryview_fromslice", 0);
  14597. /* "View.MemoryView":1007
  14598. * cdef _memoryviewslice result
  14599. *
  14600. * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
  14601. * return None
  14602. *
  14603. */
  14604. __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
  14605. if (__pyx_t_1) {
  14606. /* "View.MemoryView":1008
  14607. *
  14608. * if <PyObject *> memviewslice.memview == Py_None:
  14609. * return None # <<<<<<<<<<<<<<
  14610. *
  14611. *
  14612. */
  14613. __Pyx_XDECREF(__pyx_r);
  14614. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  14615. goto __pyx_L0;
  14616. /* "View.MemoryView":1007
  14617. * cdef _memoryviewslice result
  14618. *
  14619. * if <PyObject *> memviewslice.memview == Py_None: # <<<<<<<<<<<<<<
  14620. * return None
  14621. *
  14622. */
  14623. }
  14624. /* "View.MemoryView":1013
  14625. *
  14626. *
  14627. * result = _memoryviewslice(None, 0, dtype_is_object) # <<<<<<<<<<<<<<
  14628. *
  14629. * result.from_slice = memviewslice
  14630. */
  14631. __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
  14632. __Pyx_GOTREF(__pyx_t_2);
  14633. __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1013, __pyx_L1_error)
  14634. __Pyx_GOTREF(__pyx_t_3);
  14635. __Pyx_INCREF(Py_None);
  14636. __Pyx_GIVEREF(Py_None);
  14637. PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
  14638. __Pyx_INCREF(__pyx_int_0);
  14639. __Pyx_GIVEREF(__pyx_int_0);
  14640. PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
  14641. __Pyx_GIVEREF(__pyx_t_2);
  14642. PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
  14643. __pyx_t_2 = 0;
  14644. __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1013, __pyx_L1_error)
  14645. __Pyx_GOTREF(__pyx_t_2);
  14646. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14647. __pyx_v_result = ((struct __pyx_memoryviewslice_obj *)__pyx_t_2);
  14648. __pyx_t_2 = 0;
  14649. /* "View.MemoryView":1015
  14650. * result = _memoryviewslice(None, 0, dtype_is_object)
  14651. *
  14652. * result.from_slice = memviewslice # <<<<<<<<<<<<<<
  14653. * __PYX_INC_MEMVIEW(&memviewslice, 1)
  14654. *
  14655. */
  14656. __pyx_v_result->from_slice = __pyx_v_memviewslice;
  14657. /* "View.MemoryView":1016
  14658. *
  14659. * result.from_slice = memviewslice
  14660. * __PYX_INC_MEMVIEW(&memviewslice, 1) # <<<<<<<<<<<<<<
  14661. *
  14662. * result.from_object = (<memoryview> memviewslice.memview).base
  14663. */
  14664. __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
  14665. /* "View.MemoryView":1018
  14666. * __PYX_INC_MEMVIEW(&memviewslice, 1)
  14667. *
  14668. * result.from_object = (<memoryview> memviewslice.memview).base # <<<<<<<<<<<<<<
  14669. * result.typeinfo = memviewslice.memview.typeinfo
  14670. *
  14671. */
  14672. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1018, __pyx_L1_error)
  14673. __Pyx_GOTREF(__pyx_t_2);
  14674. __Pyx_GIVEREF(__pyx_t_2);
  14675. __Pyx_GOTREF(__pyx_v_result->from_object);
  14676. __Pyx_DECREF(__pyx_v_result->from_object);
  14677. __pyx_v_result->from_object = __pyx_t_2;
  14678. __pyx_t_2 = 0;
  14679. /* "View.MemoryView":1019
  14680. *
  14681. * result.from_object = (<memoryview> memviewslice.memview).base
  14682. * result.typeinfo = memviewslice.memview.typeinfo # <<<<<<<<<<<<<<
  14683. *
  14684. * result.view = memviewslice.memview.view
  14685. */
  14686. __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
  14687. __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
  14688. /* "View.MemoryView":1021
  14689. * result.typeinfo = memviewslice.memview.typeinfo
  14690. *
  14691. * result.view = memviewslice.memview.view # <<<<<<<<<<<<<<
  14692. * result.view.buf = <void *> memviewslice.data
  14693. * result.view.ndim = ndim
  14694. */
  14695. __pyx_t_5 = __pyx_v_memviewslice.memview->view;
  14696. __pyx_v_result->__pyx_base.view = __pyx_t_5;
  14697. /* "View.MemoryView":1022
  14698. *
  14699. * result.view = memviewslice.memview.view
  14700. * result.view.buf = <void *> memviewslice.data # <<<<<<<<<<<<<<
  14701. * result.view.ndim = ndim
  14702. * (<__pyx_buffer *> &result.view).obj = Py_None
  14703. */
  14704. __pyx_v_result->__pyx_base.view.buf = ((void *)__pyx_v_memviewslice.data);
  14705. /* "View.MemoryView":1023
  14706. * result.view = memviewslice.memview.view
  14707. * result.view.buf = <void *> memviewslice.data
  14708. * result.view.ndim = ndim # <<<<<<<<<<<<<<
  14709. * (<__pyx_buffer *> &result.view).obj = Py_None
  14710. * Py_INCREF(Py_None)
  14711. */
  14712. __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
  14713. /* "View.MemoryView":1024
  14714. * result.view.buf = <void *> memviewslice.data
  14715. * result.view.ndim = ndim
  14716. * (<__pyx_buffer *> &result.view).obj = Py_None # <<<<<<<<<<<<<<
  14717. * Py_INCREF(Py_None)
  14718. *
  14719. */
  14720. ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
  14721. /* "View.MemoryView":1025
  14722. * result.view.ndim = ndim
  14723. * (<__pyx_buffer *> &result.view).obj = Py_None
  14724. * Py_INCREF(Py_None) # <<<<<<<<<<<<<<
  14725. *
  14726. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
  14727. */
  14728. Py_INCREF(Py_None);
  14729. /* "View.MemoryView":1027
  14730. * Py_INCREF(Py_None)
  14731. *
  14732. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
  14733. * result.flags = PyBUF_RECORDS
  14734. * else:
  14735. */
  14736. __pyx_t_1 = ((((struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
  14737. if (__pyx_t_1) {
  14738. /* "View.MemoryView":1028
  14739. *
  14740. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE:
  14741. * result.flags = PyBUF_RECORDS # <<<<<<<<<<<<<<
  14742. * else:
  14743. * result.flags = PyBUF_RECORDS_RO
  14744. */
  14745. __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
  14746. /* "View.MemoryView":1027
  14747. * Py_INCREF(Py_None)
  14748. *
  14749. * if (<memoryview>memviewslice.memview).flags & PyBUF_WRITABLE: # <<<<<<<<<<<<<<
  14750. * result.flags = PyBUF_RECORDS
  14751. * else:
  14752. */
  14753. goto __pyx_L4;
  14754. }
  14755. /* "View.MemoryView":1030
  14756. * result.flags = PyBUF_RECORDS
  14757. * else:
  14758. * result.flags = PyBUF_RECORDS_RO # <<<<<<<<<<<<<<
  14759. *
  14760. * result.view.shape = <Py_ssize_t *> result.from_slice.shape
  14761. */
  14762. /*else*/ {
  14763. __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
  14764. }
  14765. __pyx_L4:;
  14766. /* "View.MemoryView":1032
  14767. * result.flags = PyBUF_RECORDS_RO
  14768. *
  14769. * result.view.shape = <Py_ssize_t *> result.from_slice.shape # <<<<<<<<<<<<<<
  14770. * result.view.strides = <Py_ssize_t *> result.from_slice.strides
  14771. *
  14772. */
  14773. __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
  14774. /* "View.MemoryView":1033
  14775. *
  14776. * result.view.shape = <Py_ssize_t *> result.from_slice.shape
  14777. * result.view.strides = <Py_ssize_t *> result.from_slice.strides # <<<<<<<<<<<<<<
  14778. *
  14779. *
  14780. */
  14781. __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
  14782. /* "View.MemoryView":1036
  14783. *
  14784. *
  14785. * result.view.suboffsets = NULL # <<<<<<<<<<<<<<
  14786. * for suboffset in result.from_slice.suboffsets[:ndim]:
  14787. * if suboffset >= 0:
  14788. */
  14789. __pyx_v_result->__pyx_base.view.suboffsets = NULL;
  14790. /* "View.MemoryView":1037
  14791. *
  14792. * result.view.suboffsets = NULL
  14793. * for suboffset in result.from_slice.suboffsets[:ndim]: # <<<<<<<<<<<<<<
  14794. * if suboffset >= 0:
  14795. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  14796. */
  14797. __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
  14798. for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
  14799. __pyx_t_6 = __pyx_t_8;
  14800. __pyx_v_suboffset = (__pyx_t_6[0]);
  14801. /* "View.MemoryView":1038
  14802. * result.view.suboffsets = NULL
  14803. * for suboffset in result.from_slice.suboffsets[:ndim]:
  14804. * if suboffset >= 0: # <<<<<<<<<<<<<<
  14805. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  14806. * break
  14807. */
  14808. __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
  14809. if (__pyx_t_1) {
  14810. /* "View.MemoryView":1039
  14811. * for suboffset in result.from_slice.suboffsets[:ndim]:
  14812. * if suboffset >= 0:
  14813. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets # <<<<<<<<<<<<<<
  14814. * break
  14815. *
  14816. */
  14817. __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
  14818. /* "View.MemoryView":1040
  14819. * if suboffset >= 0:
  14820. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  14821. * break # <<<<<<<<<<<<<<
  14822. *
  14823. * result.view.len = result.view.itemsize
  14824. */
  14825. goto __pyx_L6_break;
  14826. /* "View.MemoryView":1038
  14827. * result.view.suboffsets = NULL
  14828. * for suboffset in result.from_slice.suboffsets[:ndim]:
  14829. * if suboffset >= 0: # <<<<<<<<<<<<<<
  14830. * result.view.suboffsets = <Py_ssize_t *> result.from_slice.suboffsets
  14831. * break
  14832. */
  14833. }
  14834. }
  14835. __pyx_L6_break:;
  14836. /* "View.MemoryView":1042
  14837. * break
  14838. *
  14839. * result.view.len = result.view.itemsize # <<<<<<<<<<<<<<
  14840. * for length in result.view.shape[:ndim]:
  14841. * result.view.len *= length
  14842. */
  14843. __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
  14844. __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  14845. /* "View.MemoryView":1043
  14846. *
  14847. * result.view.len = result.view.itemsize
  14848. * for length in result.view.shape[:ndim]: # <<<<<<<<<<<<<<
  14849. * result.view.len *= length
  14850. *
  14851. */
  14852. __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
  14853. for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
  14854. __pyx_t_6 = __pyx_t_8;
  14855. __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0])); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1043, __pyx_L1_error)
  14856. __Pyx_GOTREF(__pyx_t_2);
  14857. __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
  14858. __pyx_t_2 = 0;
  14859. /* "View.MemoryView":1044
  14860. * result.view.len = result.view.itemsize
  14861. * for length in result.view.shape[:ndim]:
  14862. * result.view.len *= length # <<<<<<<<<<<<<<
  14863. *
  14864. * result.to_object_func = to_object_func
  14865. */
  14866. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1044, __pyx_L1_error)
  14867. __Pyx_GOTREF(__pyx_t_2);
  14868. __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1044, __pyx_L1_error)
  14869. __Pyx_GOTREF(__pyx_t_3);
  14870. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  14871. __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1044, __pyx_L1_error)
  14872. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  14873. __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
  14874. }
  14875. /* "View.MemoryView":1046
  14876. * result.view.len *= length
  14877. *
  14878. * result.to_object_func = to_object_func # <<<<<<<<<<<<<<
  14879. * result.to_dtype_func = to_dtype_func
  14880. *
  14881. */
  14882. __pyx_v_result->to_object_func = __pyx_v_to_object_func;
  14883. /* "View.MemoryView":1047
  14884. *
  14885. * result.to_object_func = to_object_func
  14886. * result.to_dtype_func = to_dtype_func # <<<<<<<<<<<<<<
  14887. *
  14888. * return result
  14889. */
  14890. __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
  14891. /* "View.MemoryView":1049
  14892. * result.to_dtype_func = to_dtype_func
  14893. *
  14894. * return result # <<<<<<<<<<<<<<
  14895. *
  14896. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  14897. */
  14898. __Pyx_XDECREF(__pyx_r);
  14899. __Pyx_INCREF(((PyObject *)__pyx_v_result));
  14900. __pyx_r = ((PyObject *)__pyx_v_result);
  14901. goto __pyx_L0;
  14902. /* "View.MemoryView":999
  14903. *
  14904. * @cname('__pyx_memoryview_fromslice')
  14905. * cdef memoryview_fromslice(__Pyx_memviewslice memviewslice, # <<<<<<<<<<<<<<
  14906. * int ndim,
  14907. * object (*to_object_func)(char *),
  14908. */
  14909. /* function exit code */
  14910. __pyx_L1_error:;
  14911. __Pyx_XDECREF(__pyx_t_2);
  14912. __Pyx_XDECREF(__pyx_t_3);
  14913. __Pyx_AddTraceback("View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  14914. __pyx_r = 0;
  14915. __pyx_L0:;
  14916. __Pyx_XDECREF((PyObject *)__pyx_v_result);
  14917. __Pyx_XDECREF(__pyx_v_length);
  14918. __Pyx_XGIVEREF(__pyx_r);
  14919. __Pyx_RefNannyFinishContext();
  14920. return __pyx_r;
  14921. }
  14922. /* "View.MemoryView":1052
  14923. *
  14924. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  14925. * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
  14926. * __Pyx_memviewslice *mslice) except NULL:
  14927. * cdef _memoryviewslice obj
  14928. */
  14929. static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
  14930. struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
  14931. __Pyx_memviewslice *__pyx_r;
  14932. __Pyx_RefNannyDeclarations
  14933. int __pyx_t_1;
  14934. int __pyx_t_2;
  14935. PyObject *__pyx_t_3 = NULL;
  14936. __Pyx_RefNannySetupContext("get_slice_from_memview", 0);
  14937. /* "View.MemoryView":1055
  14938. * __Pyx_memviewslice *mslice) except NULL:
  14939. * cdef _memoryviewslice obj
  14940. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  14941. * obj = memview
  14942. * return &obj.from_slice
  14943. */
  14944. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  14945. __pyx_t_2 = (__pyx_t_1 != 0);
  14946. if (__pyx_t_2) {
  14947. /* "View.MemoryView":1056
  14948. * cdef _memoryviewslice obj
  14949. * if isinstance(memview, _memoryviewslice):
  14950. * obj = memview # <<<<<<<<<<<<<<
  14951. * return &obj.from_slice
  14952. * else:
  14953. */
  14954. if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1056, __pyx_L1_error)
  14955. __pyx_t_3 = ((PyObject *)__pyx_v_memview);
  14956. __Pyx_INCREF(__pyx_t_3);
  14957. __pyx_v_obj = ((struct __pyx_memoryviewslice_obj *)__pyx_t_3);
  14958. __pyx_t_3 = 0;
  14959. /* "View.MemoryView":1057
  14960. * if isinstance(memview, _memoryviewslice):
  14961. * obj = memview
  14962. * return &obj.from_slice # <<<<<<<<<<<<<<
  14963. * else:
  14964. * slice_copy(memview, mslice)
  14965. */
  14966. __pyx_r = (&__pyx_v_obj->from_slice);
  14967. goto __pyx_L0;
  14968. /* "View.MemoryView":1055
  14969. * __Pyx_memviewslice *mslice) except NULL:
  14970. * cdef _memoryviewslice obj
  14971. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  14972. * obj = memview
  14973. * return &obj.from_slice
  14974. */
  14975. }
  14976. /* "View.MemoryView":1059
  14977. * return &obj.from_slice
  14978. * else:
  14979. * slice_copy(memview, mslice) # <<<<<<<<<<<<<<
  14980. * return mslice
  14981. *
  14982. */
  14983. /*else*/ {
  14984. __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
  14985. /* "View.MemoryView":1060
  14986. * else:
  14987. * slice_copy(memview, mslice)
  14988. * return mslice # <<<<<<<<<<<<<<
  14989. *
  14990. * @cname('__pyx_memoryview_slice_copy')
  14991. */
  14992. __pyx_r = __pyx_v_mslice;
  14993. goto __pyx_L0;
  14994. }
  14995. /* "View.MemoryView":1052
  14996. *
  14997. * @cname('__pyx_memoryview_get_slice_from_memoryview')
  14998. * cdef __Pyx_memviewslice *get_slice_from_memview(memoryview memview, # <<<<<<<<<<<<<<
  14999. * __Pyx_memviewslice *mslice) except NULL:
  15000. * cdef _memoryviewslice obj
  15001. */
  15002. /* function exit code */
  15003. __pyx_L1_error:;
  15004. __Pyx_XDECREF(__pyx_t_3);
  15005. __Pyx_AddTraceback("View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15006. __pyx_r = NULL;
  15007. __pyx_L0:;
  15008. __Pyx_XDECREF((PyObject *)__pyx_v_obj);
  15009. __Pyx_RefNannyFinishContext();
  15010. return __pyx_r;
  15011. }
  15012. /* "View.MemoryView":1063
  15013. *
  15014. * @cname('__pyx_memoryview_slice_copy')
  15015. * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
  15016. * cdef int dim
  15017. * cdef (Py_ssize_t*) shape, strides, suboffsets
  15018. */
  15019. static void __pyx_memoryview_slice_copy(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
  15020. int __pyx_v_dim;
  15021. Py_ssize_t *__pyx_v_shape;
  15022. Py_ssize_t *__pyx_v_strides;
  15023. Py_ssize_t *__pyx_v_suboffsets;
  15024. __Pyx_RefNannyDeclarations
  15025. Py_ssize_t *__pyx_t_1;
  15026. int __pyx_t_2;
  15027. int __pyx_t_3;
  15028. int __pyx_t_4;
  15029. Py_ssize_t __pyx_t_5;
  15030. __Pyx_RefNannySetupContext("slice_copy", 0);
  15031. /* "View.MemoryView":1067
  15032. * cdef (Py_ssize_t*) shape, strides, suboffsets
  15033. *
  15034. * shape = memview.view.shape # <<<<<<<<<<<<<<
  15035. * strides = memview.view.strides
  15036. * suboffsets = memview.view.suboffsets
  15037. */
  15038. __pyx_t_1 = __pyx_v_memview->view.shape;
  15039. __pyx_v_shape = __pyx_t_1;
  15040. /* "View.MemoryView":1068
  15041. *
  15042. * shape = memview.view.shape
  15043. * strides = memview.view.strides # <<<<<<<<<<<<<<
  15044. * suboffsets = memview.view.suboffsets
  15045. *
  15046. */
  15047. __pyx_t_1 = __pyx_v_memview->view.strides;
  15048. __pyx_v_strides = __pyx_t_1;
  15049. /* "View.MemoryView":1069
  15050. * shape = memview.view.shape
  15051. * strides = memview.view.strides
  15052. * suboffsets = memview.view.suboffsets # <<<<<<<<<<<<<<
  15053. *
  15054. * dst.memview = <__pyx_memoryview *> memview
  15055. */
  15056. __pyx_t_1 = __pyx_v_memview->view.suboffsets;
  15057. __pyx_v_suboffsets = __pyx_t_1;
  15058. /* "View.MemoryView":1071
  15059. * suboffsets = memview.view.suboffsets
  15060. *
  15061. * dst.memview = <__pyx_memoryview *> memview # <<<<<<<<<<<<<<
  15062. * dst.data = <char *> memview.view.buf
  15063. *
  15064. */
  15065. __pyx_v_dst->memview = ((struct __pyx_memoryview_obj *)__pyx_v_memview);
  15066. /* "View.MemoryView":1072
  15067. *
  15068. * dst.memview = <__pyx_memoryview *> memview
  15069. * dst.data = <char *> memview.view.buf # <<<<<<<<<<<<<<
  15070. *
  15071. * for dim in range(memview.view.ndim):
  15072. */
  15073. __pyx_v_dst->data = ((char *)__pyx_v_memview->view.buf);
  15074. /* "View.MemoryView":1074
  15075. * dst.data = <char *> memview.view.buf
  15076. *
  15077. * for dim in range(memview.view.ndim): # <<<<<<<<<<<<<<
  15078. * dst.shape[dim] = shape[dim]
  15079. * dst.strides[dim] = strides[dim]
  15080. */
  15081. __pyx_t_2 = __pyx_v_memview->view.ndim;
  15082. __pyx_t_3 = __pyx_t_2;
  15083. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  15084. __pyx_v_dim = __pyx_t_4;
  15085. /* "View.MemoryView":1075
  15086. *
  15087. * for dim in range(memview.view.ndim):
  15088. * dst.shape[dim] = shape[dim] # <<<<<<<<<<<<<<
  15089. * dst.strides[dim] = strides[dim]
  15090. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
  15091. */
  15092. (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
  15093. /* "View.MemoryView":1076
  15094. * for dim in range(memview.view.ndim):
  15095. * dst.shape[dim] = shape[dim]
  15096. * dst.strides[dim] = strides[dim] # <<<<<<<<<<<<<<
  15097. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1
  15098. *
  15099. */
  15100. (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
  15101. /* "View.MemoryView":1077
  15102. * dst.shape[dim] = shape[dim]
  15103. * dst.strides[dim] = strides[dim]
  15104. * dst.suboffsets[dim] = suboffsets[dim] if suboffsets else -1 # <<<<<<<<<<<<<<
  15105. *
  15106. * @cname('__pyx_memoryview_copy_object')
  15107. */
  15108. if ((__pyx_v_suboffsets != 0)) {
  15109. __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
  15110. } else {
  15111. __pyx_t_5 = -1L;
  15112. }
  15113. (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
  15114. }
  15115. /* "View.MemoryView":1063
  15116. *
  15117. * @cname('__pyx_memoryview_slice_copy')
  15118. * cdef void slice_copy(memoryview memview, __Pyx_memviewslice *dst): # <<<<<<<<<<<<<<
  15119. * cdef int dim
  15120. * cdef (Py_ssize_t*) shape, strides, suboffsets
  15121. */
  15122. /* function exit code */
  15123. __Pyx_RefNannyFinishContext();
  15124. }
  15125. /* "View.MemoryView":1080
  15126. *
  15127. * @cname('__pyx_memoryview_copy_object')
  15128. * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
  15129. * "Create a new memoryview object"
  15130. * cdef __Pyx_memviewslice memviewslice
  15131. */
  15132. static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx_v_memview) {
  15133. __Pyx_memviewslice __pyx_v_memviewslice;
  15134. PyObject *__pyx_r = NULL;
  15135. __Pyx_RefNannyDeclarations
  15136. PyObject *__pyx_t_1 = NULL;
  15137. __Pyx_RefNannySetupContext("memoryview_copy", 0);
  15138. /* "View.MemoryView":1083
  15139. * "Create a new memoryview object"
  15140. * cdef __Pyx_memviewslice memviewslice
  15141. * slice_copy(memview, &memviewslice) # <<<<<<<<<<<<<<
  15142. * return memoryview_copy_from_slice(memview, &memviewslice)
  15143. *
  15144. */
  15145. __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
  15146. /* "View.MemoryView":1084
  15147. * cdef __Pyx_memviewslice memviewslice
  15148. * slice_copy(memview, &memviewslice)
  15149. * return memoryview_copy_from_slice(memview, &memviewslice) # <<<<<<<<<<<<<<
  15150. *
  15151. * @cname('__pyx_memoryview_copy_object_from_slice')
  15152. */
  15153. __Pyx_XDECREF(__pyx_r);
  15154. __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice)); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1084, __pyx_L1_error)
  15155. __Pyx_GOTREF(__pyx_t_1);
  15156. __pyx_r = __pyx_t_1;
  15157. __pyx_t_1 = 0;
  15158. goto __pyx_L0;
  15159. /* "View.MemoryView":1080
  15160. *
  15161. * @cname('__pyx_memoryview_copy_object')
  15162. * cdef memoryview_copy(memoryview memview): # <<<<<<<<<<<<<<
  15163. * "Create a new memoryview object"
  15164. * cdef __Pyx_memviewslice memviewslice
  15165. */
  15166. /* function exit code */
  15167. __pyx_L1_error:;
  15168. __Pyx_XDECREF(__pyx_t_1);
  15169. __Pyx_AddTraceback("View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15170. __pyx_r = 0;
  15171. __pyx_L0:;
  15172. __Pyx_XGIVEREF(__pyx_r);
  15173. __Pyx_RefNannyFinishContext();
  15174. return __pyx_r;
  15175. }
  15176. /* "View.MemoryView":1087
  15177. *
  15178. * @cname('__pyx_memoryview_copy_object_from_slice')
  15179. * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
  15180. * """
  15181. * Create a new memoryview object from a given memoryview object and slice.
  15182. */
  15183. static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
  15184. PyObject *(*__pyx_v_to_object_func)(char *);
  15185. int (*__pyx_v_to_dtype_func)(char *, PyObject *);
  15186. PyObject *__pyx_r = NULL;
  15187. __Pyx_RefNannyDeclarations
  15188. int __pyx_t_1;
  15189. int __pyx_t_2;
  15190. PyObject *(*__pyx_t_3)(char *);
  15191. int (*__pyx_t_4)(char *, PyObject *);
  15192. PyObject *__pyx_t_5 = NULL;
  15193. __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0);
  15194. /* "View.MemoryView":1094
  15195. * cdef int (*to_dtype_func)(char *, object) except 0
  15196. *
  15197. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  15198. * to_object_func = (<_memoryviewslice> memview).to_object_func
  15199. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  15200. */
  15201. __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
  15202. __pyx_t_2 = (__pyx_t_1 != 0);
  15203. if (__pyx_t_2) {
  15204. /* "View.MemoryView":1095
  15205. *
  15206. * if isinstance(memview, _memoryviewslice):
  15207. * to_object_func = (<_memoryviewslice> memview).to_object_func # <<<<<<<<<<<<<<
  15208. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  15209. * else:
  15210. */
  15211. __pyx_t_3 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
  15212. __pyx_v_to_object_func = __pyx_t_3;
  15213. /* "View.MemoryView":1096
  15214. * if isinstance(memview, _memoryviewslice):
  15215. * to_object_func = (<_memoryviewslice> memview).to_object_func
  15216. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func # <<<<<<<<<<<<<<
  15217. * else:
  15218. * to_object_func = NULL
  15219. */
  15220. __pyx_t_4 = ((struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
  15221. __pyx_v_to_dtype_func = __pyx_t_4;
  15222. /* "View.MemoryView":1094
  15223. * cdef int (*to_dtype_func)(char *, object) except 0
  15224. *
  15225. * if isinstance(memview, _memoryviewslice): # <<<<<<<<<<<<<<
  15226. * to_object_func = (<_memoryviewslice> memview).to_object_func
  15227. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  15228. */
  15229. goto __pyx_L3;
  15230. }
  15231. /* "View.MemoryView":1098
  15232. * to_dtype_func = (<_memoryviewslice> memview).to_dtype_func
  15233. * else:
  15234. * to_object_func = NULL # <<<<<<<<<<<<<<
  15235. * to_dtype_func = NULL
  15236. *
  15237. */
  15238. /*else*/ {
  15239. __pyx_v_to_object_func = NULL;
  15240. /* "View.MemoryView":1099
  15241. * else:
  15242. * to_object_func = NULL
  15243. * to_dtype_func = NULL # <<<<<<<<<<<<<<
  15244. *
  15245. * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
  15246. */
  15247. __pyx_v_to_dtype_func = NULL;
  15248. }
  15249. __pyx_L3:;
  15250. /* "View.MemoryView":1101
  15251. * to_dtype_func = NULL
  15252. *
  15253. * return memoryview_fromslice(memviewslice[0], memview.view.ndim, # <<<<<<<<<<<<<<
  15254. * to_object_func, to_dtype_func,
  15255. * memview.dtype_is_object)
  15256. */
  15257. __Pyx_XDECREF(__pyx_r);
  15258. /* "View.MemoryView":1103
  15259. * return memoryview_fromslice(memviewslice[0], memview.view.ndim,
  15260. * to_object_func, to_dtype_func,
  15261. * memview.dtype_is_object) # <<<<<<<<<<<<<<
  15262. *
  15263. *
  15264. */
  15265. __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(2, 1101, __pyx_L1_error)
  15266. __Pyx_GOTREF(__pyx_t_5);
  15267. __pyx_r = __pyx_t_5;
  15268. __pyx_t_5 = 0;
  15269. goto __pyx_L0;
  15270. /* "View.MemoryView":1087
  15271. *
  15272. * @cname('__pyx_memoryview_copy_object_from_slice')
  15273. * cdef memoryview_copy_from_slice(memoryview memview, __Pyx_memviewslice *memviewslice): # <<<<<<<<<<<<<<
  15274. * """
  15275. * Create a new memoryview object from a given memoryview object and slice.
  15276. */
  15277. /* function exit code */
  15278. __pyx_L1_error:;
  15279. __Pyx_XDECREF(__pyx_t_5);
  15280. __Pyx_AddTraceback("View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
  15281. __pyx_r = 0;
  15282. __pyx_L0:;
  15283. __Pyx_XGIVEREF(__pyx_r);
  15284. __Pyx_RefNannyFinishContext();
  15285. return __pyx_r;
  15286. }
  15287. /* "View.MemoryView":1109
  15288. *
  15289. *
  15290. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
  15291. * if arg < 0:
  15292. * return -arg
  15293. */
  15294. static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
  15295. Py_ssize_t __pyx_r;
  15296. int __pyx_t_1;
  15297. /* "View.MemoryView":1110
  15298. *
  15299. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  15300. * if arg < 0: # <<<<<<<<<<<<<<
  15301. * return -arg
  15302. * else:
  15303. */
  15304. __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
  15305. if (__pyx_t_1) {
  15306. /* "View.MemoryView":1111
  15307. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  15308. * if arg < 0:
  15309. * return -arg # <<<<<<<<<<<<<<
  15310. * else:
  15311. * return arg
  15312. */
  15313. __pyx_r = (-__pyx_v_arg);
  15314. goto __pyx_L0;
  15315. /* "View.MemoryView":1110
  15316. *
  15317. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil:
  15318. * if arg < 0: # <<<<<<<<<<<<<<
  15319. * return -arg
  15320. * else:
  15321. */
  15322. }
  15323. /* "View.MemoryView":1113
  15324. * return -arg
  15325. * else:
  15326. * return arg # <<<<<<<<<<<<<<
  15327. *
  15328. * @cname('__pyx_get_best_slice_order')
  15329. */
  15330. /*else*/ {
  15331. __pyx_r = __pyx_v_arg;
  15332. goto __pyx_L0;
  15333. }
  15334. /* "View.MemoryView":1109
  15335. *
  15336. *
  15337. * cdef Py_ssize_t abs_py_ssize_t(Py_ssize_t arg) nogil: # <<<<<<<<<<<<<<
  15338. * if arg < 0:
  15339. * return -arg
  15340. */
  15341. /* function exit code */
  15342. __pyx_L0:;
  15343. return __pyx_r;
  15344. }
  15345. /* "View.MemoryView":1116
  15346. *
  15347. * @cname('__pyx_get_best_slice_order')
  15348. * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
  15349. * """
  15350. * Figure out the best memory access order for a given slice.
  15351. */
  15352. static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim) {
  15353. int __pyx_v_i;
  15354. Py_ssize_t __pyx_v_c_stride;
  15355. Py_ssize_t __pyx_v_f_stride;
  15356. char __pyx_r;
  15357. int __pyx_t_1;
  15358. int __pyx_t_2;
  15359. int __pyx_t_3;
  15360. int __pyx_t_4;
  15361. /* "View.MemoryView":1121
  15362. * """
  15363. * cdef int i
  15364. * cdef Py_ssize_t c_stride = 0 # <<<<<<<<<<<<<<
  15365. * cdef Py_ssize_t f_stride = 0
  15366. *
  15367. */
  15368. __pyx_v_c_stride = 0;
  15369. /* "View.MemoryView":1122
  15370. * cdef int i
  15371. * cdef Py_ssize_t c_stride = 0
  15372. * cdef Py_ssize_t f_stride = 0 # <<<<<<<<<<<<<<
  15373. *
  15374. * for i in range(ndim - 1, -1, -1):
  15375. */
  15376. __pyx_v_f_stride = 0;
  15377. /* "View.MemoryView":1124
  15378. * cdef Py_ssize_t f_stride = 0
  15379. *
  15380. * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  15381. * if mslice.shape[i] > 1:
  15382. * c_stride = mslice.strides[i]
  15383. */
  15384. for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
  15385. __pyx_v_i = __pyx_t_1;
  15386. /* "View.MemoryView":1125
  15387. *
  15388. * for i in range(ndim - 1, -1, -1):
  15389. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  15390. * c_stride = mslice.strides[i]
  15391. * break
  15392. */
  15393. __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
  15394. if (__pyx_t_2) {
  15395. /* "View.MemoryView":1126
  15396. * for i in range(ndim - 1, -1, -1):
  15397. * if mslice.shape[i] > 1:
  15398. * c_stride = mslice.strides[i] # <<<<<<<<<<<<<<
  15399. * break
  15400. *
  15401. */
  15402. __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
  15403. /* "View.MemoryView":1127
  15404. * if mslice.shape[i] > 1:
  15405. * c_stride = mslice.strides[i]
  15406. * break # <<<<<<<<<<<<<<
  15407. *
  15408. * for i in range(ndim):
  15409. */
  15410. goto __pyx_L4_break;
  15411. /* "View.MemoryView":1125
  15412. *
  15413. * for i in range(ndim - 1, -1, -1):
  15414. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  15415. * c_stride = mslice.strides[i]
  15416. * break
  15417. */
  15418. }
  15419. }
  15420. __pyx_L4_break:;
  15421. /* "View.MemoryView":1129
  15422. * break
  15423. *
  15424. * for i in range(ndim): # <<<<<<<<<<<<<<
  15425. * if mslice.shape[i] > 1:
  15426. * f_stride = mslice.strides[i]
  15427. */
  15428. __pyx_t_1 = __pyx_v_ndim;
  15429. __pyx_t_3 = __pyx_t_1;
  15430. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  15431. __pyx_v_i = __pyx_t_4;
  15432. /* "View.MemoryView":1130
  15433. *
  15434. * for i in range(ndim):
  15435. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  15436. * f_stride = mslice.strides[i]
  15437. * break
  15438. */
  15439. __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
  15440. if (__pyx_t_2) {
  15441. /* "View.MemoryView":1131
  15442. * for i in range(ndim):
  15443. * if mslice.shape[i] > 1:
  15444. * f_stride = mslice.strides[i] # <<<<<<<<<<<<<<
  15445. * break
  15446. *
  15447. */
  15448. __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
  15449. /* "View.MemoryView":1132
  15450. * if mslice.shape[i] > 1:
  15451. * f_stride = mslice.strides[i]
  15452. * break # <<<<<<<<<<<<<<
  15453. *
  15454. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
  15455. */
  15456. goto __pyx_L7_break;
  15457. /* "View.MemoryView":1130
  15458. *
  15459. * for i in range(ndim):
  15460. * if mslice.shape[i] > 1: # <<<<<<<<<<<<<<
  15461. * f_stride = mslice.strides[i]
  15462. * break
  15463. */
  15464. }
  15465. }
  15466. __pyx_L7_break:;
  15467. /* "View.MemoryView":1134
  15468. * break
  15469. *
  15470. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
  15471. * return 'C'
  15472. * else:
  15473. */
  15474. __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
  15475. if (__pyx_t_2) {
  15476. /* "View.MemoryView":1135
  15477. *
  15478. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride):
  15479. * return 'C' # <<<<<<<<<<<<<<
  15480. * else:
  15481. * return 'F'
  15482. */
  15483. __pyx_r = 'C';
  15484. goto __pyx_L0;
  15485. /* "View.MemoryView":1134
  15486. * break
  15487. *
  15488. * if abs_py_ssize_t(c_stride) <= abs_py_ssize_t(f_stride): # <<<<<<<<<<<<<<
  15489. * return 'C'
  15490. * else:
  15491. */
  15492. }
  15493. /* "View.MemoryView":1137
  15494. * return 'C'
  15495. * else:
  15496. * return 'F' # <<<<<<<<<<<<<<
  15497. *
  15498. * @cython.cdivision(True)
  15499. */
  15500. /*else*/ {
  15501. __pyx_r = 'F';
  15502. goto __pyx_L0;
  15503. }
  15504. /* "View.MemoryView":1116
  15505. *
  15506. * @cname('__pyx_get_best_slice_order')
  15507. * cdef char get_best_order(__Pyx_memviewslice *mslice, int ndim) nogil: # <<<<<<<<<<<<<<
  15508. * """
  15509. * Figure out the best memory access order for a given slice.
  15510. */
  15511. /* function exit code */
  15512. __pyx_L0:;
  15513. return __pyx_r;
  15514. }
  15515. /* "View.MemoryView":1140
  15516. *
  15517. * @cython.cdivision(True)
  15518. * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
  15519. * char *dst_data, Py_ssize_t *dst_strides,
  15520. * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
  15521. */
  15522. 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) {
  15523. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  15524. CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
  15525. Py_ssize_t __pyx_v_dst_extent;
  15526. Py_ssize_t __pyx_v_src_stride;
  15527. Py_ssize_t __pyx_v_dst_stride;
  15528. int __pyx_t_1;
  15529. int __pyx_t_2;
  15530. int __pyx_t_3;
  15531. Py_ssize_t __pyx_t_4;
  15532. Py_ssize_t __pyx_t_5;
  15533. Py_ssize_t __pyx_t_6;
  15534. /* "View.MemoryView":1147
  15535. *
  15536. * cdef Py_ssize_t i
  15537. * cdef Py_ssize_t src_extent = src_shape[0] # <<<<<<<<<<<<<<
  15538. * cdef Py_ssize_t dst_extent = dst_shape[0]
  15539. * cdef Py_ssize_t src_stride = src_strides[0]
  15540. */
  15541. __pyx_v_src_extent = (__pyx_v_src_shape[0]);
  15542. /* "View.MemoryView":1148
  15543. * cdef Py_ssize_t i
  15544. * cdef Py_ssize_t src_extent = src_shape[0]
  15545. * cdef Py_ssize_t dst_extent = dst_shape[0] # <<<<<<<<<<<<<<
  15546. * cdef Py_ssize_t src_stride = src_strides[0]
  15547. * cdef Py_ssize_t dst_stride = dst_strides[0]
  15548. */
  15549. __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
  15550. /* "View.MemoryView":1149
  15551. * cdef Py_ssize_t src_extent = src_shape[0]
  15552. * cdef Py_ssize_t dst_extent = dst_shape[0]
  15553. * cdef Py_ssize_t src_stride = src_strides[0] # <<<<<<<<<<<<<<
  15554. * cdef Py_ssize_t dst_stride = dst_strides[0]
  15555. *
  15556. */
  15557. __pyx_v_src_stride = (__pyx_v_src_strides[0]);
  15558. /* "View.MemoryView":1150
  15559. * cdef Py_ssize_t dst_extent = dst_shape[0]
  15560. * cdef Py_ssize_t src_stride = src_strides[0]
  15561. * cdef Py_ssize_t dst_stride = dst_strides[0] # <<<<<<<<<<<<<<
  15562. *
  15563. * if ndim == 1:
  15564. */
  15565. __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
  15566. /* "View.MemoryView":1152
  15567. * cdef Py_ssize_t dst_stride = dst_strides[0]
  15568. *
  15569. * if ndim == 1: # <<<<<<<<<<<<<<
  15570. * if (src_stride > 0 and dst_stride > 0 and
  15571. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  15572. */
  15573. __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  15574. if (__pyx_t_1) {
  15575. /* "View.MemoryView":1153
  15576. *
  15577. * if ndim == 1:
  15578. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  15579. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  15580. * memcpy(dst_data, src_data, itemsize * dst_extent)
  15581. */
  15582. __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
  15583. if (__pyx_t_2) {
  15584. } else {
  15585. __pyx_t_1 = __pyx_t_2;
  15586. goto __pyx_L5_bool_binop_done;
  15587. }
  15588. __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
  15589. if (__pyx_t_2) {
  15590. } else {
  15591. __pyx_t_1 = __pyx_t_2;
  15592. goto __pyx_L5_bool_binop_done;
  15593. }
  15594. /* "View.MemoryView":1154
  15595. * if ndim == 1:
  15596. * if (src_stride > 0 and dst_stride > 0 and
  15597. * <size_t> src_stride == itemsize == <size_t> dst_stride): # <<<<<<<<<<<<<<
  15598. * memcpy(dst_data, src_data, itemsize * dst_extent)
  15599. * else:
  15600. */
  15601. __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
  15602. if (__pyx_t_2) {
  15603. __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
  15604. }
  15605. __pyx_t_3 = (__pyx_t_2 != 0);
  15606. __pyx_t_1 = __pyx_t_3;
  15607. __pyx_L5_bool_binop_done:;
  15608. /* "View.MemoryView":1153
  15609. *
  15610. * if ndim == 1:
  15611. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  15612. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  15613. * memcpy(dst_data, src_data, itemsize * dst_extent)
  15614. */
  15615. if (__pyx_t_1) {
  15616. /* "View.MemoryView":1155
  15617. * if (src_stride > 0 and dst_stride > 0 and
  15618. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  15619. * memcpy(dst_data, src_data, itemsize * dst_extent) # <<<<<<<<<<<<<<
  15620. * else:
  15621. * for i in range(dst_extent):
  15622. */
  15623. (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
  15624. /* "View.MemoryView":1153
  15625. *
  15626. * if ndim == 1:
  15627. * if (src_stride > 0 and dst_stride > 0 and # <<<<<<<<<<<<<<
  15628. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  15629. * memcpy(dst_data, src_data, itemsize * dst_extent)
  15630. */
  15631. goto __pyx_L4;
  15632. }
  15633. /* "View.MemoryView":1157
  15634. * memcpy(dst_data, src_data, itemsize * dst_extent)
  15635. * else:
  15636. * for i in range(dst_extent): # <<<<<<<<<<<<<<
  15637. * memcpy(dst_data, src_data, itemsize)
  15638. * src_data += src_stride
  15639. */
  15640. /*else*/ {
  15641. __pyx_t_4 = __pyx_v_dst_extent;
  15642. __pyx_t_5 = __pyx_t_4;
  15643. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  15644. __pyx_v_i = __pyx_t_6;
  15645. /* "View.MemoryView":1158
  15646. * else:
  15647. * for i in range(dst_extent):
  15648. * memcpy(dst_data, src_data, itemsize) # <<<<<<<<<<<<<<
  15649. * src_data += src_stride
  15650. * dst_data += dst_stride
  15651. */
  15652. (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
  15653. /* "View.MemoryView":1159
  15654. * for i in range(dst_extent):
  15655. * memcpy(dst_data, src_data, itemsize)
  15656. * src_data += src_stride # <<<<<<<<<<<<<<
  15657. * dst_data += dst_stride
  15658. * else:
  15659. */
  15660. __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
  15661. /* "View.MemoryView":1160
  15662. * memcpy(dst_data, src_data, itemsize)
  15663. * src_data += src_stride
  15664. * dst_data += dst_stride # <<<<<<<<<<<<<<
  15665. * else:
  15666. * for i in range(dst_extent):
  15667. */
  15668. __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
  15669. }
  15670. }
  15671. __pyx_L4:;
  15672. /* "View.MemoryView":1152
  15673. * cdef Py_ssize_t dst_stride = dst_strides[0]
  15674. *
  15675. * if ndim == 1: # <<<<<<<<<<<<<<
  15676. * if (src_stride > 0 and dst_stride > 0 and
  15677. * <size_t> src_stride == itemsize == <size_t> dst_stride):
  15678. */
  15679. goto __pyx_L3;
  15680. }
  15681. /* "View.MemoryView":1162
  15682. * dst_data += dst_stride
  15683. * else:
  15684. * for i in range(dst_extent): # <<<<<<<<<<<<<<
  15685. * _copy_strided_to_strided(src_data, src_strides + 1,
  15686. * dst_data, dst_strides + 1,
  15687. */
  15688. /*else*/ {
  15689. __pyx_t_4 = __pyx_v_dst_extent;
  15690. __pyx_t_5 = __pyx_t_4;
  15691. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  15692. __pyx_v_i = __pyx_t_6;
  15693. /* "View.MemoryView":1163
  15694. * else:
  15695. * for i in range(dst_extent):
  15696. * _copy_strided_to_strided(src_data, src_strides + 1, # <<<<<<<<<<<<<<
  15697. * dst_data, dst_strides + 1,
  15698. * src_shape + 1, dst_shape + 1,
  15699. */
  15700. _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);
  15701. /* "View.MemoryView":1167
  15702. * src_shape + 1, dst_shape + 1,
  15703. * ndim - 1, itemsize)
  15704. * src_data += src_stride # <<<<<<<<<<<<<<
  15705. * dst_data += dst_stride
  15706. *
  15707. */
  15708. __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
  15709. /* "View.MemoryView":1168
  15710. * ndim - 1, itemsize)
  15711. * src_data += src_stride
  15712. * dst_data += dst_stride # <<<<<<<<<<<<<<
  15713. *
  15714. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src,
  15715. */
  15716. __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
  15717. }
  15718. }
  15719. __pyx_L3:;
  15720. /* "View.MemoryView":1140
  15721. *
  15722. * @cython.cdivision(True)
  15723. * cdef void _copy_strided_to_strided(char *src_data, Py_ssize_t *src_strides, # <<<<<<<<<<<<<<
  15724. * char *dst_data, Py_ssize_t *dst_strides,
  15725. * Py_ssize_t *src_shape, Py_ssize_t *dst_shape,
  15726. */
  15727. /* function exit code */
  15728. }
  15729. /* "View.MemoryView":1170
  15730. * dst_data += dst_stride
  15731. *
  15732. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  15733. * __Pyx_memviewslice *dst,
  15734. * int ndim, size_t itemsize) nogil:
  15735. */
  15736. 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) {
  15737. /* "View.MemoryView":1173
  15738. * __Pyx_memviewslice *dst,
  15739. * int ndim, size_t itemsize) nogil:
  15740. * _copy_strided_to_strided(src.data, src.strides, dst.data, dst.strides, # <<<<<<<<<<<<<<
  15741. * src.shape, dst.shape, ndim, itemsize)
  15742. *
  15743. */
  15744. _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);
  15745. /* "View.MemoryView":1170
  15746. * dst_data += dst_stride
  15747. *
  15748. * cdef void copy_strided_to_strided(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  15749. * __Pyx_memviewslice *dst,
  15750. * int ndim, size_t itemsize) nogil:
  15751. */
  15752. /* function exit code */
  15753. }
  15754. /* "View.MemoryView":1177
  15755. *
  15756. * @cname('__pyx_memoryview_slice_get_size')
  15757. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
  15758. * "Return the size of the memory occupied by the slice in number of bytes"
  15759. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  15760. */
  15761. static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src, int __pyx_v_ndim) {
  15762. Py_ssize_t __pyx_v_shape;
  15763. Py_ssize_t __pyx_v_size;
  15764. Py_ssize_t __pyx_r;
  15765. Py_ssize_t __pyx_t_1;
  15766. Py_ssize_t *__pyx_t_2;
  15767. Py_ssize_t *__pyx_t_3;
  15768. Py_ssize_t *__pyx_t_4;
  15769. /* "View.MemoryView":1179
  15770. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil:
  15771. * "Return the size of the memory occupied by the slice in number of bytes"
  15772. * cdef Py_ssize_t shape, size = src.memview.view.itemsize # <<<<<<<<<<<<<<
  15773. *
  15774. * for shape in src.shape[:ndim]:
  15775. */
  15776. __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  15777. __pyx_v_size = __pyx_t_1;
  15778. /* "View.MemoryView":1181
  15779. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  15780. *
  15781. * for shape in src.shape[:ndim]: # <<<<<<<<<<<<<<
  15782. * size *= shape
  15783. *
  15784. */
  15785. __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
  15786. for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
  15787. __pyx_t_2 = __pyx_t_4;
  15788. __pyx_v_shape = (__pyx_t_2[0]);
  15789. /* "View.MemoryView":1182
  15790. *
  15791. * for shape in src.shape[:ndim]:
  15792. * size *= shape # <<<<<<<<<<<<<<
  15793. *
  15794. * return size
  15795. */
  15796. __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
  15797. }
  15798. /* "View.MemoryView":1184
  15799. * size *= shape
  15800. *
  15801. * return size # <<<<<<<<<<<<<<
  15802. *
  15803. * @cname('__pyx_fill_contig_strides_array')
  15804. */
  15805. __pyx_r = __pyx_v_size;
  15806. goto __pyx_L0;
  15807. /* "View.MemoryView":1177
  15808. *
  15809. * @cname('__pyx_memoryview_slice_get_size')
  15810. * cdef Py_ssize_t slice_get_size(__Pyx_memviewslice *src, int ndim) nogil: # <<<<<<<<<<<<<<
  15811. * "Return the size of the memory occupied by the slice in number of bytes"
  15812. * cdef Py_ssize_t shape, size = src.memview.view.itemsize
  15813. */
  15814. /* function exit code */
  15815. __pyx_L0:;
  15816. return __pyx_r;
  15817. }
  15818. /* "View.MemoryView":1187
  15819. *
  15820. * @cname('__pyx_fill_contig_strides_array')
  15821. * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
  15822. * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
  15823. * int ndim, char order) nogil:
  15824. */
  15825. 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) {
  15826. int __pyx_v_idx;
  15827. Py_ssize_t __pyx_r;
  15828. int __pyx_t_1;
  15829. int __pyx_t_2;
  15830. int __pyx_t_3;
  15831. int __pyx_t_4;
  15832. /* "View.MemoryView":1196
  15833. * cdef int idx
  15834. *
  15835. * if order == 'F': # <<<<<<<<<<<<<<
  15836. * for idx in range(ndim):
  15837. * strides[idx] = stride
  15838. */
  15839. __pyx_t_1 = ((__pyx_v_order == 'F') != 0);
  15840. if (__pyx_t_1) {
  15841. /* "View.MemoryView":1197
  15842. *
  15843. * if order == 'F':
  15844. * for idx in range(ndim): # <<<<<<<<<<<<<<
  15845. * strides[idx] = stride
  15846. * stride *= shape[idx]
  15847. */
  15848. __pyx_t_2 = __pyx_v_ndim;
  15849. __pyx_t_3 = __pyx_t_2;
  15850. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  15851. __pyx_v_idx = __pyx_t_4;
  15852. /* "View.MemoryView":1198
  15853. * if order == 'F':
  15854. * for idx in range(ndim):
  15855. * strides[idx] = stride # <<<<<<<<<<<<<<
  15856. * stride *= shape[idx]
  15857. * else:
  15858. */
  15859. (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
  15860. /* "View.MemoryView":1199
  15861. * for idx in range(ndim):
  15862. * strides[idx] = stride
  15863. * stride *= shape[idx] # <<<<<<<<<<<<<<
  15864. * else:
  15865. * for idx in range(ndim - 1, -1, -1):
  15866. */
  15867. __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
  15868. }
  15869. /* "View.MemoryView":1196
  15870. * cdef int idx
  15871. *
  15872. * if order == 'F': # <<<<<<<<<<<<<<
  15873. * for idx in range(ndim):
  15874. * strides[idx] = stride
  15875. */
  15876. goto __pyx_L3;
  15877. }
  15878. /* "View.MemoryView":1201
  15879. * stride *= shape[idx]
  15880. * else:
  15881. * for idx in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  15882. * strides[idx] = stride
  15883. * stride *= shape[idx]
  15884. */
  15885. /*else*/ {
  15886. for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
  15887. __pyx_v_idx = __pyx_t_2;
  15888. /* "View.MemoryView":1202
  15889. * else:
  15890. * for idx in range(ndim - 1, -1, -1):
  15891. * strides[idx] = stride # <<<<<<<<<<<<<<
  15892. * stride *= shape[idx]
  15893. *
  15894. */
  15895. (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
  15896. /* "View.MemoryView":1203
  15897. * for idx in range(ndim - 1, -1, -1):
  15898. * strides[idx] = stride
  15899. * stride *= shape[idx] # <<<<<<<<<<<<<<
  15900. *
  15901. * return stride
  15902. */
  15903. __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
  15904. }
  15905. }
  15906. __pyx_L3:;
  15907. /* "View.MemoryView":1205
  15908. * stride *= shape[idx]
  15909. *
  15910. * return stride # <<<<<<<<<<<<<<
  15911. *
  15912. * @cname('__pyx_memoryview_copy_data_to_temp')
  15913. */
  15914. __pyx_r = __pyx_v_stride;
  15915. goto __pyx_L0;
  15916. /* "View.MemoryView":1187
  15917. *
  15918. * @cname('__pyx_fill_contig_strides_array')
  15919. * cdef Py_ssize_t fill_contig_strides_array( # <<<<<<<<<<<<<<
  15920. * Py_ssize_t *shape, Py_ssize_t *strides, Py_ssize_t stride,
  15921. * int ndim, char order) nogil:
  15922. */
  15923. /* function exit code */
  15924. __pyx_L0:;
  15925. return __pyx_r;
  15926. }
  15927. /* "View.MemoryView":1208
  15928. *
  15929. * @cname('__pyx_memoryview_copy_data_to_temp')
  15930. * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  15931. * __Pyx_memviewslice *tmpslice,
  15932. * char order,
  15933. */
  15934. 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) {
  15935. int __pyx_v_i;
  15936. void *__pyx_v_result;
  15937. size_t __pyx_v_itemsize;
  15938. size_t __pyx_v_size;
  15939. void *__pyx_r;
  15940. Py_ssize_t __pyx_t_1;
  15941. int __pyx_t_2;
  15942. int __pyx_t_3;
  15943. struct __pyx_memoryview_obj *__pyx_t_4;
  15944. int __pyx_t_5;
  15945. int __pyx_t_6;
  15946. /* "View.MemoryView":1219
  15947. * cdef void *result
  15948. *
  15949. * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
  15950. * cdef size_t size = slice_get_size(src, ndim)
  15951. *
  15952. */
  15953. __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
  15954. __pyx_v_itemsize = __pyx_t_1;
  15955. /* "View.MemoryView":1220
  15956. *
  15957. * cdef size_t itemsize = src.memview.view.itemsize
  15958. * cdef size_t size = slice_get_size(src, ndim) # <<<<<<<<<<<<<<
  15959. *
  15960. * result = malloc(size)
  15961. */
  15962. __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
  15963. /* "View.MemoryView":1222
  15964. * cdef size_t size = slice_get_size(src, ndim)
  15965. *
  15966. * result = malloc(size) # <<<<<<<<<<<<<<
  15967. * if not result:
  15968. * _err(MemoryError, NULL)
  15969. */
  15970. __pyx_v_result = malloc(__pyx_v_size);
  15971. /* "View.MemoryView":1223
  15972. *
  15973. * result = malloc(size)
  15974. * if not result: # <<<<<<<<<<<<<<
  15975. * _err(MemoryError, NULL)
  15976. *
  15977. */
  15978. __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
  15979. if (__pyx_t_2) {
  15980. /* "View.MemoryView":1224
  15981. * result = malloc(size)
  15982. * if not result:
  15983. * _err(MemoryError, NULL) # <<<<<<<<<<<<<<
  15984. *
  15985. *
  15986. */
  15987. __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(2, 1224, __pyx_L1_error)
  15988. /* "View.MemoryView":1223
  15989. *
  15990. * result = malloc(size)
  15991. * if not result: # <<<<<<<<<<<<<<
  15992. * _err(MemoryError, NULL)
  15993. *
  15994. */
  15995. }
  15996. /* "View.MemoryView":1227
  15997. *
  15998. *
  15999. * tmpslice.data = <char *> result # <<<<<<<<<<<<<<
  16000. * tmpslice.memview = src.memview
  16001. * for i in range(ndim):
  16002. */
  16003. __pyx_v_tmpslice->data = ((char *)__pyx_v_result);
  16004. /* "View.MemoryView":1228
  16005. *
  16006. * tmpslice.data = <char *> result
  16007. * tmpslice.memview = src.memview # <<<<<<<<<<<<<<
  16008. * for i in range(ndim):
  16009. * tmpslice.shape[i] = src.shape[i]
  16010. */
  16011. __pyx_t_4 = __pyx_v_src->memview;
  16012. __pyx_v_tmpslice->memview = __pyx_t_4;
  16013. /* "View.MemoryView":1229
  16014. * tmpslice.data = <char *> result
  16015. * tmpslice.memview = src.memview
  16016. * for i in range(ndim): # <<<<<<<<<<<<<<
  16017. * tmpslice.shape[i] = src.shape[i]
  16018. * tmpslice.suboffsets[i] = -1
  16019. */
  16020. __pyx_t_3 = __pyx_v_ndim;
  16021. __pyx_t_5 = __pyx_t_3;
  16022. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  16023. __pyx_v_i = __pyx_t_6;
  16024. /* "View.MemoryView":1230
  16025. * tmpslice.memview = src.memview
  16026. * for i in range(ndim):
  16027. * tmpslice.shape[i] = src.shape[i] # <<<<<<<<<<<<<<
  16028. * tmpslice.suboffsets[i] = -1
  16029. *
  16030. */
  16031. (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
  16032. /* "View.MemoryView":1231
  16033. * for i in range(ndim):
  16034. * tmpslice.shape[i] = src.shape[i]
  16035. * tmpslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
  16036. *
  16037. * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize,
  16038. */
  16039. (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
  16040. }
  16041. /* "View.MemoryView":1233
  16042. * tmpslice.suboffsets[i] = -1
  16043. *
  16044. * fill_contig_strides_array(&tmpslice.shape[0], &tmpslice.strides[0], itemsize, # <<<<<<<<<<<<<<
  16045. * ndim, order)
  16046. *
  16047. */
  16048. (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));
  16049. /* "View.MemoryView":1237
  16050. *
  16051. *
  16052. * for i in range(ndim): # <<<<<<<<<<<<<<
  16053. * if tmpslice.shape[i] == 1:
  16054. * tmpslice.strides[i] = 0
  16055. */
  16056. __pyx_t_3 = __pyx_v_ndim;
  16057. __pyx_t_5 = __pyx_t_3;
  16058. for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
  16059. __pyx_v_i = __pyx_t_6;
  16060. /* "View.MemoryView":1238
  16061. *
  16062. * for i in range(ndim):
  16063. * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
  16064. * tmpslice.strides[i] = 0
  16065. *
  16066. */
  16067. __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
  16068. if (__pyx_t_2) {
  16069. /* "View.MemoryView":1239
  16070. * for i in range(ndim):
  16071. * if tmpslice.shape[i] == 1:
  16072. * tmpslice.strides[i] = 0 # <<<<<<<<<<<<<<
  16073. *
  16074. * if slice_is_contig(src[0], order, ndim):
  16075. */
  16076. (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
  16077. /* "View.MemoryView":1238
  16078. *
  16079. * for i in range(ndim):
  16080. * if tmpslice.shape[i] == 1: # <<<<<<<<<<<<<<
  16081. * tmpslice.strides[i] = 0
  16082. *
  16083. */
  16084. }
  16085. }
  16086. /* "View.MemoryView":1241
  16087. * tmpslice.strides[i] = 0
  16088. *
  16089. * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
  16090. * memcpy(result, src.data, size)
  16091. * else:
  16092. */
  16093. __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
  16094. if (__pyx_t_2) {
  16095. /* "View.MemoryView":1242
  16096. *
  16097. * if slice_is_contig(src[0], order, ndim):
  16098. * memcpy(result, src.data, size) # <<<<<<<<<<<<<<
  16099. * else:
  16100. * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
  16101. */
  16102. (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
  16103. /* "View.MemoryView":1241
  16104. * tmpslice.strides[i] = 0
  16105. *
  16106. * if slice_is_contig(src[0], order, ndim): # <<<<<<<<<<<<<<
  16107. * memcpy(result, src.data, size)
  16108. * else:
  16109. */
  16110. goto __pyx_L9;
  16111. }
  16112. /* "View.MemoryView":1244
  16113. * memcpy(result, src.data, size)
  16114. * else:
  16115. * copy_strided_to_strided(src, tmpslice, ndim, itemsize) # <<<<<<<<<<<<<<
  16116. *
  16117. * return result
  16118. */
  16119. /*else*/ {
  16120. copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
  16121. }
  16122. __pyx_L9:;
  16123. /* "View.MemoryView":1246
  16124. * copy_strided_to_strided(src, tmpslice, ndim, itemsize)
  16125. *
  16126. * return result # <<<<<<<<<<<<<<
  16127. *
  16128. *
  16129. */
  16130. __pyx_r = __pyx_v_result;
  16131. goto __pyx_L0;
  16132. /* "View.MemoryView":1208
  16133. *
  16134. * @cname('__pyx_memoryview_copy_data_to_temp')
  16135. * cdef void *copy_data_to_temp(__Pyx_memviewslice *src, # <<<<<<<<<<<<<<
  16136. * __Pyx_memviewslice *tmpslice,
  16137. * char order,
  16138. */
  16139. /* function exit code */
  16140. __pyx_L1_error:;
  16141. {
  16142. #ifdef WITH_THREAD
  16143. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  16144. #endif
  16145. __Pyx_AddTraceback("View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16146. #ifdef WITH_THREAD
  16147. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  16148. #endif
  16149. }
  16150. __pyx_r = NULL;
  16151. __pyx_L0:;
  16152. return __pyx_r;
  16153. }
  16154. /* "View.MemoryView":1251
  16155. *
  16156. * @cname('__pyx_memoryview_err_extents')
  16157. * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
  16158. * Py_ssize_t extent2) except -1 with gil:
  16159. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  16160. */
  16161. static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
  16162. int __pyx_r;
  16163. __Pyx_RefNannyDeclarations
  16164. PyObject *__pyx_t_1 = NULL;
  16165. PyObject *__pyx_t_2 = NULL;
  16166. PyObject *__pyx_t_3 = NULL;
  16167. PyObject *__pyx_t_4 = NULL;
  16168. #ifdef WITH_THREAD
  16169. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  16170. #endif
  16171. __Pyx_RefNannySetupContext("_err_extents", 0);
  16172. /* "View.MemoryView":1254
  16173. * Py_ssize_t extent2) except -1 with gil:
  16174. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  16175. * (i, extent1, extent2)) # <<<<<<<<<<<<<<
  16176. *
  16177. * @cname('__pyx_memoryview_err_dim')
  16178. */
  16179. __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1254, __pyx_L1_error)
  16180. __Pyx_GOTREF(__pyx_t_1);
  16181. __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1254, __pyx_L1_error)
  16182. __Pyx_GOTREF(__pyx_t_2);
  16183. __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1254, __pyx_L1_error)
  16184. __Pyx_GOTREF(__pyx_t_3);
  16185. __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1254, __pyx_L1_error)
  16186. __Pyx_GOTREF(__pyx_t_4);
  16187. __Pyx_GIVEREF(__pyx_t_1);
  16188. PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
  16189. __Pyx_GIVEREF(__pyx_t_2);
  16190. PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
  16191. __Pyx_GIVEREF(__pyx_t_3);
  16192. PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
  16193. __pyx_t_1 = 0;
  16194. __pyx_t_2 = 0;
  16195. __pyx_t_3 = 0;
  16196. /* "View.MemoryView":1253
  16197. * cdef int _err_extents(int i, Py_ssize_t extent1,
  16198. * Py_ssize_t extent2) except -1 with gil:
  16199. * raise ValueError("got differing extents in dimension %d (got %d and %d)" % # <<<<<<<<<<<<<<
  16200. * (i, extent1, extent2))
  16201. *
  16202. */
  16203. __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1253, __pyx_L1_error)
  16204. __Pyx_GOTREF(__pyx_t_3);
  16205. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  16206. __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1253, __pyx_L1_error)
  16207. __Pyx_GOTREF(__pyx_t_4);
  16208. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16209. __Pyx_Raise(__pyx_t_4, 0, 0, 0);
  16210. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  16211. __PYX_ERR(2, 1253, __pyx_L1_error)
  16212. /* "View.MemoryView":1251
  16213. *
  16214. * @cname('__pyx_memoryview_err_extents')
  16215. * cdef int _err_extents(int i, Py_ssize_t extent1, # <<<<<<<<<<<<<<
  16216. * Py_ssize_t extent2) except -1 with gil:
  16217. * raise ValueError("got differing extents in dimension %d (got %d and %d)" %
  16218. */
  16219. /* function exit code */
  16220. __pyx_L1_error:;
  16221. __Pyx_XDECREF(__pyx_t_1);
  16222. __Pyx_XDECREF(__pyx_t_2);
  16223. __Pyx_XDECREF(__pyx_t_3);
  16224. __Pyx_XDECREF(__pyx_t_4);
  16225. __Pyx_AddTraceback("View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16226. __pyx_r = -1;
  16227. __Pyx_RefNannyFinishContext();
  16228. #ifdef WITH_THREAD
  16229. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  16230. #endif
  16231. return __pyx_r;
  16232. }
  16233. /* "View.MemoryView":1257
  16234. *
  16235. * @cname('__pyx_memoryview_err_dim')
  16236. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
  16237. * raise error(msg.decode('ascii') % dim)
  16238. *
  16239. */
  16240. static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, int __pyx_v_dim) {
  16241. int __pyx_r;
  16242. __Pyx_RefNannyDeclarations
  16243. PyObject *__pyx_t_1 = NULL;
  16244. PyObject *__pyx_t_2 = NULL;
  16245. PyObject *__pyx_t_3 = NULL;
  16246. PyObject *__pyx_t_4 = NULL;
  16247. #ifdef WITH_THREAD
  16248. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  16249. #endif
  16250. __Pyx_RefNannySetupContext("_err_dim", 0);
  16251. __Pyx_INCREF(__pyx_v_error);
  16252. /* "View.MemoryView":1258
  16253. * @cname('__pyx_memoryview_err_dim')
  16254. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil:
  16255. * raise error(msg.decode('ascii') % dim) # <<<<<<<<<<<<<<
  16256. *
  16257. * @cname('__pyx_memoryview_err')
  16258. */
  16259. __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(2, 1258, __pyx_L1_error)
  16260. __Pyx_GOTREF(__pyx_t_2);
  16261. __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1258, __pyx_L1_error)
  16262. __Pyx_GOTREF(__pyx_t_3);
  16263. __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1258, __pyx_L1_error)
  16264. __Pyx_GOTREF(__pyx_t_4);
  16265. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  16266. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16267. __Pyx_INCREF(__pyx_v_error);
  16268. __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
  16269. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
  16270. __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
  16271. if (likely(__pyx_t_2)) {
  16272. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
  16273. __Pyx_INCREF(__pyx_t_2);
  16274. __Pyx_INCREF(function);
  16275. __Pyx_DECREF_SET(__pyx_t_3, function);
  16276. }
  16277. }
  16278. __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);
  16279. __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
  16280. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  16281. if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1258, __pyx_L1_error)
  16282. __Pyx_GOTREF(__pyx_t_1);
  16283. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16284. __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  16285. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  16286. __PYX_ERR(2, 1258, __pyx_L1_error)
  16287. /* "View.MemoryView":1257
  16288. *
  16289. * @cname('__pyx_memoryview_err_dim')
  16290. * cdef int _err_dim(object error, char *msg, int dim) except -1 with gil: # <<<<<<<<<<<<<<
  16291. * raise error(msg.decode('ascii') % dim)
  16292. *
  16293. */
  16294. /* function exit code */
  16295. __pyx_L1_error:;
  16296. __Pyx_XDECREF(__pyx_t_1);
  16297. __Pyx_XDECREF(__pyx_t_2);
  16298. __Pyx_XDECREF(__pyx_t_3);
  16299. __Pyx_XDECREF(__pyx_t_4);
  16300. __Pyx_AddTraceback("View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16301. __pyx_r = -1;
  16302. __Pyx_XDECREF(__pyx_v_error);
  16303. __Pyx_RefNannyFinishContext();
  16304. #ifdef WITH_THREAD
  16305. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  16306. #endif
  16307. return __pyx_r;
  16308. }
  16309. /* "View.MemoryView":1261
  16310. *
  16311. * @cname('__pyx_memoryview_err')
  16312. * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
  16313. * if msg != NULL:
  16314. * raise error(msg.decode('ascii'))
  16315. */
  16316. static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) {
  16317. int __pyx_r;
  16318. __Pyx_RefNannyDeclarations
  16319. int __pyx_t_1;
  16320. PyObject *__pyx_t_2 = NULL;
  16321. PyObject *__pyx_t_3 = NULL;
  16322. PyObject *__pyx_t_4 = NULL;
  16323. PyObject *__pyx_t_5 = NULL;
  16324. #ifdef WITH_THREAD
  16325. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  16326. #endif
  16327. __Pyx_RefNannySetupContext("_err", 0);
  16328. __Pyx_INCREF(__pyx_v_error);
  16329. /* "View.MemoryView":1262
  16330. * @cname('__pyx_memoryview_err')
  16331. * cdef int _err(object error, char *msg) except -1 with gil:
  16332. * if msg != NULL: # <<<<<<<<<<<<<<
  16333. * raise error(msg.decode('ascii'))
  16334. * else:
  16335. */
  16336. __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
  16337. if (unlikely(__pyx_t_1)) {
  16338. /* "View.MemoryView":1263
  16339. * cdef int _err(object error, char *msg) except -1 with gil:
  16340. * if msg != NULL:
  16341. * raise error(msg.decode('ascii')) # <<<<<<<<<<<<<<
  16342. * else:
  16343. * raise error
  16344. */
  16345. __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(2, 1263, __pyx_L1_error)
  16346. __Pyx_GOTREF(__pyx_t_3);
  16347. __Pyx_INCREF(__pyx_v_error);
  16348. __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
  16349. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
  16350. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
  16351. if (likely(__pyx_t_5)) {
  16352. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
  16353. __Pyx_INCREF(__pyx_t_5);
  16354. __Pyx_INCREF(function);
  16355. __Pyx_DECREF_SET(__pyx_t_4, function);
  16356. }
  16357. }
  16358. __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);
  16359. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  16360. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  16361. if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1263, __pyx_L1_error)
  16362. __Pyx_GOTREF(__pyx_t_2);
  16363. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  16364. __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  16365. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  16366. __PYX_ERR(2, 1263, __pyx_L1_error)
  16367. /* "View.MemoryView":1262
  16368. * @cname('__pyx_memoryview_err')
  16369. * cdef int _err(object error, char *msg) except -1 with gil:
  16370. * if msg != NULL: # <<<<<<<<<<<<<<
  16371. * raise error(msg.decode('ascii'))
  16372. * else:
  16373. */
  16374. }
  16375. /* "View.MemoryView":1265
  16376. * raise error(msg.decode('ascii'))
  16377. * else:
  16378. * raise error # <<<<<<<<<<<<<<
  16379. *
  16380. * @cname('__pyx_memoryview_copy_contents')
  16381. */
  16382. /*else*/ {
  16383. __Pyx_Raise(__pyx_v_error, 0, 0, 0);
  16384. __PYX_ERR(2, 1265, __pyx_L1_error)
  16385. }
  16386. /* "View.MemoryView":1261
  16387. *
  16388. * @cname('__pyx_memoryview_err')
  16389. * cdef int _err(object error, char *msg) except -1 with gil: # <<<<<<<<<<<<<<
  16390. * if msg != NULL:
  16391. * raise error(msg.decode('ascii'))
  16392. */
  16393. /* function exit code */
  16394. __pyx_L1_error:;
  16395. __Pyx_XDECREF(__pyx_t_2);
  16396. __Pyx_XDECREF(__pyx_t_3);
  16397. __Pyx_XDECREF(__pyx_t_4);
  16398. __Pyx_XDECREF(__pyx_t_5);
  16399. __Pyx_AddTraceback("View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16400. __pyx_r = -1;
  16401. __Pyx_XDECREF(__pyx_v_error);
  16402. __Pyx_RefNannyFinishContext();
  16403. #ifdef WITH_THREAD
  16404. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  16405. #endif
  16406. return __pyx_r;
  16407. }
  16408. /* "View.MemoryView":1268
  16409. *
  16410. * @cname('__pyx_memoryview_copy_contents')
  16411. * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
  16412. * __Pyx_memviewslice dst,
  16413. * int src_ndim, int dst_ndim,
  16414. */
  16415. 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) {
  16416. void *__pyx_v_tmpdata;
  16417. size_t __pyx_v_itemsize;
  16418. int __pyx_v_i;
  16419. char __pyx_v_order;
  16420. int __pyx_v_broadcasting;
  16421. int __pyx_v_direct_copy;
  16422. __Pyx_memviewslice __pyx_v_tmp;
  16423. int __pyx_v_ndim;
  16424. int __pyx_r;
  16425. Py_ssize_t __pyx_t_1;
  16426. int __pyx_t_2;
  16427. int __pyx_t_3;
  16428. int __pyx_t_4;
  16429. int __pyx_t_5;
  16430. int __pyx_t_6;
  16431. void *__pyx_t_7;
  16432. int __pyx_t_8;
  16433. /* "View.MemoryView":1276
  16434. * Check for overlapping memory and verify the shapes.
  16435. * """
  16436. * cdef void *tmpdata = NULL # <<<<<<<<<<<<<<
  16437. * cdef size_t itemsize = src.memview.view.itemsize
  16438. * cdef int i
  16439. */
  16440. __pyx_v_tmpdata = NULL;
  16441. /* "View.MemoryView":1277
  16442. * """
  16443. * cdef void *tmpdata = NULL
  16444. * cdef size_t itemsize = src.memview.view.itemsize # <<<<<<<<<<<<<<
  16445. * cdef int i
  16446. * cdef char order = get_best_order(&src, src_ndim)
  16447. */
  16448. __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
  16449. __pyx_v_itemsize = __pyx_t_1;
  16450. /* "View.MemoryView":1279
  16451. * cdef size_t itemsize = src.memview.view.itemsize
  16452. * cdef int i
  16453. * cdef char order = get_best_order(&src, src_ndim) # <<<<<<<<<<<<<<
  16454. * cdef bint broadcasting = False
  16455. * cdef bint direct_copy = False
  16456. */
  16457. __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
  16458. /* "View.MemoryView":1280
  16459. * cdef int i
  16460. * cdef char order = get_best_order(&src, src_ndim)
  16461. * cdef bint broadcasting = False # <<<<<<<<<<<<<<
  16462. * cdef bint direct_copy = False
  16463. * cdef __Pyx_memviewslice tmp
  16464. */
  16465. __pyx_v_broadcasting = 0;
  16466. /* "View.MemoryView":1281
  16467. * cdef char order = get_best_order(&src, src_ndim)
  16468. * cdef bint broadcasting = False
  16469. * cdef bint direct_copy = False # <<<<<<<<<<<<<<
  16470. * cdef __Pyx_memviewslice tmp
  16471. *
  16472. */
  16473. __pyx_v_direct_copy = 0;
  16474. /* "View.MemoryView":1284
  16475. * cdef __Pyx_memviewslice tmp
  16476. *
  16477. * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
  16478. * broadcast_leading(&src, src_ndim, dst_ndim)
  16479. * elif dst_ndim < src_ndim:
  16480. */
  16481. __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
  16482. if (__pyx_t_2) {
  16483. /* "View.MemoryView":1285
  16484. *
  16485. * if src_ndim < dst_ndim:
  16486. * broadcast_leading(&src, src_ndim, dst_ndim) # <<<<<<<<<<<<<<
  16487. * elif dst_ndim < src_ndim:
  16488. * broadcast_leading(&dst, dst_ndim, src_ndim)
  16489. */
  16490. __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
  16491. /* "View.MemoryView":1284
  16492. * cdef __Pyx_memviewslice tmp
  16493. *
  16494. * if src_ndim < dst_ndim: # <<<<<<<<<<<<<<
  16495. * broadcast_leading(&src, src_ndim, dst_ndim)
  16496. * elif dst_ndim < src_ndim:
  16497. */
  16498. goto __pyx_L3;
  16499. }
  16500. /* "View.MemoryView":1286
  16501. * if src_ndim < dst_ndim:
  16502. * broadcast_leading(&src, src_ndim, dst_ndim)
  16503. * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
  16504. * broadcast_leading(&dst, dst_ndim, src_ndim)
  16505. *
  16506. */
  16507. __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
  16508. if (__pyx_t_2) {
  16509. /* "View.MemoryView":1287
  16510. * broadcast_leading(&src, src_ndim, dst_ndim)
  16511. * elif dst_ndim < src_ndim:
  16512. * broadcast_leading(&dst, dst_ndim, src_ndim) # <<<<<<<<<<<<<<
  16513. *
  16514. * cdef int ndim = max(src_ndim, dst_ndim)
  16515. */
  16516. __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
  16517. /* "View.MemoryView":1286
  16518. * if src_ndim < dst_ndim:
  16519. * broadcast_leading(&src, src_ndim, dst_ndim)
  16520. * elif dst_ndim < src_ndim: # <<<<<<<<<<<<<<
  16521. * broadcast_leading(&dst, dst_ndim, src_ndim)
  16522. *
  16523. */
  16524. }
  16525. __pyx_L3:;
  16526. /* "View.MemoryView":1289
  16527. * broadcast_leading(&dst, dst_ndim, src_ndim)
  16528. *
  16529. * cdef int ndim = max(src_ndim, dst_ndim) # <<<<<<<<<<<<<<
  16530. *
  16531. * for i in range(ndim):
  16532. */
  16533. __pyx_t_3 = __pyx_v_dst_ndim;
  16534. __pyx_t_4 = __pyx_v_src_ndim;
  16535. if (((__pyx_t_3 > __pyx_t_4) != 0)) {
  16536. __pyx_t_5 = __pyx_t_3;
  16537. } else {
  16538. __pyx_t_5 = __pyx_t_4;
  16539. }
  16540. __pyx_v_ndim = __pyx_t_5;
  16541. /* "View.MemoryView":1291
  16542. * cdef int ndim = max(src_ndim, dst_ndim)
  16543. *
  16544. * for i in range(ndim): # <<<<<<<<<<<<<<
  16545. * if src.shape[i] != dst.shape[i]:
  16546. * if src.shape[i] == 1:
  16547. */
  16548. __pyx_t_5 = __pyx_v_ndim;
  16549. __pyx_t_3 = __pyx_t_5;
  16550. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  16551. __pyx_v_i = __pyx_t_4;
  16552. /* "View.MemoryView":1292
  16553. *
  16554. * for i in range(ndim):
  16555. * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
  16556. * if src.shape[i] == 1:
  16557. * broadcasting = True
  16558. */
  16559. __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
  16560. if (__pyx_t_2) {
  16561. /* "View.MemoryView":1293
  16562. * for i in range(ndim):
  16563. * if src.shape[i] != dst.shape[i]:
  16564. * if src.shape[i] == 1: # <<<<<<<<<<<<<<
  16565. * broadcasting = True
  16566. * src.strides[i] = 0
  16567. */
  16568. __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
  16569. if (__pyx_t_2) {
  16570. /* "View.MemoryView":1294
  16571. * if src.shape[i] != dst.shape[i]:
  16572. * if src.shape[i] == 1:
  16573. * broadcasting = True # <<<<<<<<<<<<<<
  16574. * src.strides[i] = 0
  16575. * else:
  16576. */
  16577. __pyx_v_broadcasting = 1;
  16578. /* "View.MemoryView":1295
  16579. * if src.shape[i] == 1:
  16580. * broadcasting = True
  16581. * src.strides[i] = 0 # <<<<<<<<<<<<<<
  16582. * else:
  16583. * _err_extents(i, dst.shape[i], src.shape[i])
  16584. */
  16585. (__pyx_v_src.strides[__pyx_v_i]) = 0;
  16586. /* "View.MemoryView":1293
  16587. * for i in range(ndim):
  16588. * if src.shape[i] != dst.shape[i]:
  16589. * if src.shape[i] == 1: # <<<<<<<<<<<<<<
  16590. * broadcasting = True
  16591. * src.strides[i] = 0
  16592. */
  16593. goto __pyx_L7;
  16594. }
  16595. /* "View.MemoryView":1297
  16596. * src.strides[i] = 0
  16597. * else:
  16598. * _err_extents(i, dst.shape[i], src.shape[i]) # <<<<<<<<<<<<<<
  16599. *
  16600. * if src.suboffsets[i] >= 0:
  16601. */
  16602. /*else*/ {
  16603. __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(2, 1297, __pyx_L1_error)
  16604. }
  16605. __pyx_L7:;
  16606. /* "View.MemoryView":1292
  16607. *
  16608. * for i in range(ndim):
  16609. * if src.shape[i] != dst.shape[i]: # <<<<<<<<<<<<<<
  16610. * if src.shape[i] == 1:
  16611. * broadcasting = True
  16612. */
  16613. }
  16614. /* "View.MemoryView":1299
  16615. * _err_extents(i, dst.shape[i], src.shape[i])
  16616. *
  16617. * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
  16618. * _err_dim(ValueError, "Dimension %d is not direct", i)
  16619. *
  16620. */
  16621. __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
  16622. if (__pyx_t_2) {
  16623. /* "View.MemoryView":1300
  16624. *
  16625. * if src.suboffsets[i] >= 0:
  16626. * _err_dim(ValueError, "Dimension %d is not direct", i) # <<<<<<<<<<<<<<
  16627. *
  16628. * if slices_overlap(&src, &dst, ndim, itemsize):
  16629. */
  16630. __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(2, 1300, __pyx_L1_error)
  16631. /* "View.MemoryView":1299
  16632. * _err_extents(i, dst.shape[i], src.shape[i])
  16633. *
  16634. * if src.suboffsets[i] >= 0: # <<<<<<<<<<<<<<
  16635. * _err_dim(ValueError, "Dimension %d is not direct", i)
  16636. *
  16637. */
  16638. }
  16639. }
  16640. /* "View.MemoryView":1302
  16641. * _err_dim(ValueError, "Dimension %d is not direct", i)
  16642. *
  16643. * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
  16644. *
  16645. * if not slice_is_contig(src, order, ndim):
  16646. */
  16647. __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
  16648. if (__pyx_t_2) {
  16649. /* "View.MemoryView":1304
  16650. * if slices_overlap(&src, &dst, ndim, itemsize):
  16651. *
  16652. * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
  16653. * order = get_best_order(&dst, ndim)
  16654. *
  16655. */
  16656. __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
  16657. if (__pyx_t_2) {
  16658. /* "View.MemoryView":1305
  16659. *
  16660. * if not slice_is_contig(src, order, ndim):
  16661. * order = get_best_order(&dst, ndim) # <<<<<<<<<<<<<<
  16662. *
  16663. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
  16664. */
  16665. __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
  16666. /* "View.MemoryView":1304
  16667. * if slices_overlap(&src, &dst, ndim, itemsize):
  16668. *
  16669. * if not slice_is_contig(src, order, ndim): # <<<<<<<<<<<<<<
  16670. * order = get_best_order(&dst, ndim)
  16671. *
  16672. */
  16673. }
  16674. /* "View.MemoryView":1307
  16675. * order = get_best_order(&dst, ndim)
  16676. *
  16677. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim) # <<<<<<<<<<<<<<
  16678. * src = tmp
  16679. *
  16680. */
  16681. __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(2, 1307, __pyx_L1_error)
  16682. __pyx_v_tmpdata = __pyx_t_7;
  16683. /* "View.MemoryView":1308
  16684. *
  16685. * tmpdata = copy_data_to_temp(&src, &tmp, order, ndim)
  16686. * src = tmp # <<<<<<<<<<<<<<
  16687. *
  16688. * if not broadcasting:
  16689. */
  16690. __pyx_v_src = __pyx_v_tmp;
  16691. /* "View.MemoryView":1302
  16692. * _err_dim(ValueError, "Dimension %d is not direct", i)
  16693. *
  16694. * if slices_overlap(&src, &dst, ndim, itemsize): # <<<<<<<<<<<<<<
  16695. *
  16696. * if not slice_is_contig(src, order, ndim):
  16697. */
  16698. }
  16699. /* "View.MemoryView":1310
  16700. * src = tmp
  16701. *
  16702. * if not broadcasting: # <<<<<<<<<<<<<<
  16703. *
  16704. *
  16705. */
  16706. __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
  16707. if (__pyx_t_2) {
  16708. /* "View.MemoryView":1313
  16709. *
  16710. *
  16711. * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
  16712. * direct_copy = slice_is_contig(dst, 'C', ndim)
  16713. * elif slice_is_contig(src, 'F', ndim):
  16714. */
  16715. __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'C', __pyx_v_ndim) != 0);
  16716. if (__pyx_t_2) {
  16717. /* "View.MemoryView":1314
  16718. *
  16719. * if slice_is_contig(src, 'C', ndim):
  16720. * direct_copy = slice_is_contig(dst, 'C', ndim) # <<<<<<<<<<<<<<
  16721. * elif slice_is_contig(src, 'F', ndim):
  16722. * direct_copy = slice_is_contig(dst, 'F', ndim)
  16723. */
  16724. __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'C', __pyx_v_ndim);
  16725. /* "View.MemoryView":1313
  16726. *
  16727. *
  16728. * if slice_is_contig(src, 'C', ndim): # <<<<<<<<<<<<<<
  16729. * direct_copy = slice_is_contig(dst, 'C', ndim)
  16730. * elif slice_is_contig(src, 'F', ndim):
  16731. */
  16732. goto __pyx_L12;
  16733. }
  16734. /* "View.MemoryView":1315
  16735. * if slice_is_contig(src, 'C', ndim):
  16736. * direct_copy = slice_is_contig(dst, 'C', ndim)
  16737. * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
  16738. * direct_copy = slice_is_contig(dst, 'F', ndim)
  16739. *
  16740. */
  16741. __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src, 'F', __pyx_v_ndim) != 0);
  16742. if (__pyx_t_2) {
  16743. /* "View.MemoryView":1316
  16744. * direct_copy = slice_is_contig(dst, 'C', ndim)
  16745. * elif slice_is_contig(src, 'F', ndim):
  16746. * direct_copy = slice_is_contig(dst, 'F', ndim) # <<<<<<<<<<<<<<
  16747. *
  16748. * if direct_copy:
  16749. */
  16750. __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst, 'F', __pyx_v_ndim);
  16751. /* "View.MemoryView":1315
  16752. * if slice_is_contig(src, 'C', ndim):
  16753. * direct_copy = slice_is_contig(dst, 'C', ndim)
  16754. * elif slice_is_contig(src, 'F', ndim): # <<<<<<<<<<<<<<
  16755. * direct_copy = slice_is_contig(dst, 'F', ndim)
  16756. *
  16757. */
  16758. }
  16759. __pyx_L12:;
  16760. /* "View.MemoryView":1318
  16761. * direct_copy = slice_is_contig(dst, 'F', ndim)
  16762. *
  16763. * if direct_copy: # <<<<<<<<<<<<<<
  16764. *
  16765. * refcount_copying(&dst, dtype_is_object, ndim, False)
  16766. */
  16767. __pyx_t_2 = (__pyx_v_direct_copy != 0);
  16768. if (__pyx_t_2) {
  16769. /* "View.MemoryView":1320
  16770. * if direct_copy:
  16771. *
  16772. * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  16773. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  16774. * refcount_copying(&dst, dtype_is_object, ndim, True)
  16775. */
  16776. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  16777. /* "View.MemoryView":1321
  16778. *
  16779. * refcount_copying(&dst, dtype_is_object, ndim, False)
  16780. * memcpy(dst.data, src.data, slice_get_size(&src, ndim)) # <<<<<<<<<<<<<<
  16781. * refcount_copying(&dst, dtype_is_object, ndim, True)
  16782. * free(tmpdata)
  16783. */
  16784. (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
  16785. /* "View.MemoryView":1322
  16786. * refcount_copying(&dst, dtype_is_object, ndim, False)
  16787. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  16788. * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  16789. * free(tmpdata)
  16790. * return 0
  16791. */
  16792. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  16793. /* "View.MemoryView":1323
  16794. * memcpy(dst.data, src.data, slice_get_size(&src, ndim))
  16795. * refcount_copying(&dst, dtype_is_object, ndim, True)
  16796. * free(tmpdata) # <<<<<<<<<<<<<<
  16797. * return 0
  16798. *
  16799. */
  16800. free(__pyx_v_tmpdata);
  16801. /* "View.MemoryView":1324
  16802. * refcount_copying(&dst, dtype_is_object, ndim, True)
  16803. * free(tmpdata)
  16804. * return 0 # <<<<<<<<<<<<<<
  16805. *
  16806. * if order == 'F' == get_best_order(&dst, ndim):
  16807. */
  16808. __pyx_r = 0;
  16809. goto __pyx_L0;
  16810. /* "View.MemoryView":1318
  16811. * direct_copy = slice_is_contig(dst, 'F', ndim)
  16812. *
  16813. * if direct_copy: # <<<<<<<<<<<<<<
  16814. *
  16815. * refcount_copying(&dst, dtype_is_object, ndim, False)
  16816. */
  16817. }
  16818. /* "View.MemoryView":1310
  16819. * src = tmp
  16820. *
  16821. * if not broadcasting: # <<<<<<<<<<<<<<
  16822. *
  16823. *
  16824. */
  16825. }
  16826. /* "View.MemoryView":1326
  16827. * return 0
  16828. *
  16829. * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
  16830. *
  16831. *
  16832. */
  16833. __pyx_t_2 = (__pyx_v_order == 'F');
  16834. if (__pyx_t_2) {
  16835. __pyx_t_2 = ('F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
  16836. }
  16837. __pyx_t_8 = (__pyx_t_2 != 0);
  16838. if (__pyx_t_8) {
  16839. /* "View.MemoryView":1329
  16840. *
  16841. *
  16842. * transpose_memslice(&src) # <<<<<<<<<<<<<<
  16843. * transpose_memslice(&dst)
  16844. *
  16845. */
  16846. __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1329, __pyx_L1_error)
  16847. /* "View.MemoryView":1330
  16848. *
  16849. * transpose_memslice(&src)
  16850. * transpose_memslice(&dst) # <<<<<<<<<<<<<<
  16851. *
  16852. * refcount_copying(&dst, dtype_is_object, ndim, False)
  16853. */
  16854. __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst)); if (unlikely(__pyx_t_5 == ((int)0))) __PYX_ERR(2, 1330, __pyx_L1_error)
  16855. /* "View.MemoryView":1326
  16856. * return 0
  16857. *
  16858. * if order == 'F' == get_best_order(&dst, ndim): # <<<<<<<<<<<<<<
  16859. *
  16860. *
  16861. */
  16862. }
  16863. /* "View.MemoryView":1332
  16864. * transpose_memslice(&dst)
  16865. *
  16866. * refcount_copying(&dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  16867. * copy_strided_to_strided(&src, &dst, ndim, itemsize)
  16868. * refcount_copying(&dst, dtype_is_object, ndim, True)
  16869. */
  16870. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  16871. /* "View.MemoryView":1333
  16872. *
  16873. * refcount_copying(&dst, dtype_is_object, ndim, False)
  16874. * copy_strided_to_strided(&src, &dst, ndim, itemsize) # <<<<<<<<<<<<<<
  16875. * refcount_copying(&dst, dtype_is_object, ndim, True)
  16876. *
  16877. */
  16878. copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
  16879. /* "View.MemoryView":1334
  16880. * refcount_copying(&dst, dtype_is_object, ndim, False)
  16881. * copy_strided_to_strided(&src, &dst, ndim, itemsize)
  16882. * refcount_copying(&dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  16883. *
  16884. * free(tmpdata)
  16885. */
  16886. __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  16887. /* "View.MemoryView":1336
  16888. * refcount_copying(&dst, dtype_is_object, ndim, True)
  16889. *
  16890. * free(tmpdata) # <<<<<<<<<<<<<<
  16891. * return 0
  16892. *
  16893. */
  16894. free(__pyx_v_tmpdata);
  16895. /* "View.MemoryView":1337
  16896. *
  16897. * free(tmpdata)
  16898. * return 0 # <<<<<<<<<<<<<<
  16899. *
  16900. * @cname('__pyx_memoryview_broadcast_leading')
  16901. */
  16902. __pyx_r = 0;
  16903. goto __pyx_L0;
  16904. /* "View.MemoryView":1268
  16905. *
  16906. * @cname('__pyx_memoryview_copy_contents')
  16907. * cdef int memoryview_copy_contents(__Pyx_memviewslice src, # <<<<<<<<<<<<<<
  16908. * __Pyx_memviewslice dst,
  16909. * int src_ndim, int dst_ndim,
  16910. */
  16911. /* function exit code */
  16912. __pyx_L1_error:;
  16913. {
  16914. #ifdef WITH_THREAD
  16915. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  16916. #endif
  16917. __Pyx_AddTraceback("View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
  16918. #ifdef WITH_THREAD
  16919. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  16920. #endif
  16921. }
  16922. __pyx_r = -1;
  16923. __pyx_L0:;
  16924. return __pyx_r;
  16925. }
  16926. /* "View.MemoryView":1340
  16927. *
  16928. * @cname('__pyx_memoryview_broadcast_leading')
  16929. * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
  16930. * int ndim,
  16931. * int ndim_other) nogil:
  16932. */
  16933. static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice, int __pyx_v_ndim, int __pyx_v_ndim_other) {
  16934. int __pyx_v_i;
  16935. int __pyx_v_offset;
  16936. int __pyx_t_1;
  16937. int __pyx_t_2;
  16938. int __pyx_t_3;
  16939. /* "View.MemoryView":1344
  16940. * int ndim_other) nogil:
  16941. * cdef int i
  16942. * cdef int offset = ndim_other - ndim # <<<<<<<<<<<<<<
  16943. *
  16944. * for i in range(ndim - 1, -1, -1):
  16945. */
  16946. __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
  16947. /* "View.MemoryView":1346
  16948. * cdef int offset = ndim_other - ndim
  16949. *
  16950. * for i in range(ndim - 1, -1, -1): # <<<<<<<<<<<<<<
  16951. * mslice.shape[i + offset] = mslice.shape[i]
  16952. * mslice.strides[i + offset] = mslice.strides[i]
  16953. */
  16954. for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
  16955. __pyx_v_i = __pyx_t_1;
  16956. /* "View.MemoryView":1347
  16957. *
  16958. * for i in range(ndim - 1, -1, -1):
  16959. * mslice.shape[i + offset] = mslice.shape[i] # <<<<<<<<<<<<<<
  16960. * mslice.strides[i + offset] = mslice.strides[i]
  16961. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  16962. */
  16963. (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
  16964. /* "View.MemoryView":1348
  16965. * for i in range(ndim - 1, -1, -1):
  16966. * mslice.shape[i + offset] = mslice.shape[i]
  16967. * mslice.strides[i + offset] = mslice.strides[i] # <<<<<<<<<<<<<<
  16968. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  16969. *
  16970. */
  16971. (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
  16972. /* "View.MemoryView":1349
  16973. * mslice.shape[i + offset] = mslice.shape[i]
  16974. * mslice.strides[i + offset] = mslice.strides[i]
  16975. * mslice.suboffsets[i + offset] = mslice.suboffsets[i] # <<<<<<<<<<<<<<
  16976. *
  16977. * for i in range(offset):
  16978. */
  16979. (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
  16980. }
  16981. /* "View.MemoryView":1351
  16982. * mslice.suboffsets[i + offset] = mslice.suboffsets[i]
  16983. *
  16984. * for i in range(offset): # <<<<<<<<<<<<<<
  16985. * mslice.shape[i] = 1
  16986. * mslice.strides[i] = mslice.strides[0]
  16987. */
  16988. __pyx_t_1 = __pyx_v_offset;
  16989. __pyx_t_2 = __pyx_t_1;
  16990. for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
  16991. __pyx_v_i = __pyx_t_3;
  16992. /* "View.MemoryView":1352
  16993. *
  16994. * for i in range(offset):
  16995. * mslice.shape[i] = 1 # <<<<<<<<<<<<<<
  16996. * mslice.strides[i] = mslice.strides[0]
  16997. * mslice.suboffsets[i] = -1
  16998. */
  16999. (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
  17000. /* "View.MemoryView":1353
  17001. * for i in range(offset):
  17002. * mslice.shape[i] = 1
  17003. * mslice.strides[i] = mslice.strides[0] # <<<<<<<<<<<<<<
  17004. * mslice.suboffsets[i] = -1
  17005. *
  17006. */
  17007. (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
  17008. /* "View.MemoryView":1354
  17009. * mslice.shape[i] = 1
  17010. * mslice.strides[i] = mslice.strides[0]
  17011. * mslice.suboffsets[i] = -1 # <<<<<<<<<<<<<<
  17012. *
  17013. *
  17014. */
  17015. (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
  17016. }
  17017. /* "View.MemoryView":1340
  17018. *
  17019. * @cname('__pyx_memoryview_broadcast_leading')
  17020. * cdef void broadcast_leading(__Pyx_memviewslice *mslice, # <<<<<<<<<<<<<<
  17021. * int ndim,
  17022. * int ndim_other) nogil:
  17023. */
  17024. /* function exit code */
  17025. }
  17026. /* "View.MemoryView":1362
  17027. *
  17028. * @cname('__pyx_memoryview_refcount_copying')
  17029. * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
  17030. * int ndim, bint inc) nogil:
  17031. *
  17032. */
  17033. 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) {
  17034. int __pyx_t_1;
  17035. /* "View.MemoryView":1366
  17036. *
  17037. *
  17038. * if dtype_is_object: # <<<<<<<<<<<<<<
  17039. * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  17040. * dst.strides, ndim, inc)
  17041. */
  17042. __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
  17043. if (__pyx_t_1) {
  17044. /* "View.MemoryView":1367
  17045. *
  17046. * if dtype_is_object:
  17047. * refcount_objects_in_slice_with_gil(dst.data, dst.shape, # <<<<<<<<<<<<<<
  17048. * dst.strides, ndim, inc)
  17049. *
  17050. */
  17051. __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);
  17052. /* "View.MemoryView":1366
  17053. *
  17054. *
  17055. * if dtype_is_object: # <<<<<<<<<<<<<<
  17056. * refcount_objects_in_slice_with_gil(dst.data, dst.shape,
  17057. * dst.strides, ndim, inc)
  17058. */
  17059. }
  17060. /* "View.MemoryView":1362
  17061. *
  17062. * @cname('__pyx_memoryview_refcount_copying')
  17063. * cdef void refcount_copying(__Pyx_memviewslice *dst, bint dtype_is_object, # <<<<<<<<<<<<<<
  17064. * int ndim, bint inc) nogil:
  17065. *
  17066. */
  17067. /* function exit code */
  17068. }
  17069. /* "View.MemoryView":1371
  17070. *
  17071. * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
  17072. * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  17073. * Py_ssize_t *strides, int ndim,
  17074. * bint inc) with gil:
  17075. */
  17076. 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) {
  17077. __Pyx_RefNannyDeclarations
  17078. #ifdef WITH_THREAD
  17079. PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
  17080. #endif
  17081. __Pyx_RefNannySetupContext("refcount_objects_in_slice_with_gil", 0);
  17082. /* "View.MemoryView":1374
  17083. * Py_ssize_t *strides, int ndim,
  17084. * bint inc) with gil:
  17085. * refcount_objects_in_slice(data, shape, strides, ndim, inc) # <<<<<<<<<<<<<<
  17086. *
  17087. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  17088. */
  17089. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
  17090. /* "View.MemoryView":1371
  17091. *
  17092. * @cname('__pyx_memoryview_refcount_objects_in_slice_with_gil')
  17093. * cdef void refcount_objects_in_slice_with_gil(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  17094. * Py_ssize_t *strides, int ndim,
  17095. * bint inc) with gil:
  17096. */
  17097. /* function exit code */
  17098. __Pyx_RefNannyFinishContext();
  17099. #ifdef WITH_THREAD
  17100. __Pyx_PyGILState_Release(__pyx_gilstate_save);
  17101. #endif
  17102. }
  17103. /* "View.MemoryView":1377
  17104. *
  17105. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  17106. * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  17107. * Py_ssize_t *strides, int ndim, bint inc):
  17108. * cdef Py_ssize_t i
  17109. */
  17110. 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) {
  17111. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  17112. __Pyx_RefNannyDeclarations
  17113. Py_ssize_t __pyx_t_1;
  17114. Py_ssize_t __pyx_t_2;
  17115. Py_ssize_t __pyx_t_3;
  17116. int __pyx_t_4;
  17117. __Pyx_RefNannySetupContext("refcount_objects_in_slice", 0);
  17118. /* "View.MemoryView":1381
  17119. * cdef Py_ssize_t i
  17120. *
  17121. * for i in range(shape[0]): # <<<<<<<<<<<<<<
  17122. * if ndim == 1:
  17123. * if inc:
  17124. */
  17125. __pyx_t_1 = (__pyx_v_shape[0]);
  17126. __pyx_t_2 = __pyx_t_1;
  17127. for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
  17128. __pyx_v_i = __pyx_t_3;
  17129. /* "View.MemoryView":1382
  17130. *
  17131. * for i in range(shape[0]):
  17132. * if ndim == 1: # <<<<<<<<<<<<<<
  17133. * if inc:
  17134. * Py_INCREF((<PyObject **> data)[0])
  17135. */
  17136. __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
  17137. if (__pyx_t_4) {
  17138. /* "View.MemoryView":1383
  17139. * for i in range(shape[0]):
  17140. * if ndim == 1:
  17141. * if inc: # <<<<<<<<<<<<<<
  17142. * Py_INCREF((<PyObject **> data)[0])
  17143. * else:
  17144. */
  17145. __pyx_t_4 = (__pyx_v_inc != 0);
  17146. if (__pyx_t_4) {
  17147. /* "View.MemoryView":1384
  17148. * if ndim == 1:
  17149. * if inc:
  17150. * Py_INCREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
  17151. * else:
  17152. * Py_DECREF((<PyObject **> data)[0])
  17153. */
  17154. Py_INCREF((((PyObject **)__pyx_v_data)[0]));
  17155. /* "View.MemoryView":1383
  17156. * for i in range(shape[0]):
  17157. * if ndim == 1:
  17158. * if inc: # <<<<<<<<<<<<<<
  17159. * Py_INCREF((<PyObject **> data)[0])
  17160. * else:
  17161. */
  17162. goto __pyx_L6;
  17163. }
  17164. /* "View.MemoryView":1386
  17165. * Py_INCREF((<PyObject **> data)[0])
  17166. * else:
  17167. * Py_DECREF((<PyObject **> data)[0]) # <<<<<<<<<<<<<<
  17168. * else:
  17169. * refcount_objects_in_slice(data, shape + 1, strides + 1,
  17170. */
  17171. /*else*/ {
  17172. Py_DECREF((((PyObject **)__pyx_v_data)[0]));
  17173. }
  17174. __pyx_L6:;
  17175. /* "View.MemoryView":1382
  17176. *
  17177. * for i in range(shape[0]):
  17178. * if ndim == 1: # <<<<<<<<<<<<<<
  17179. * if inc:
  17180. * Py_INCREF((<PyObject **> data)[0])
  17181. */
  17182. goto __pyx_L5;
  17183. }
  17184. /* "View.MemoryView":1388
  17185. * Py_DECREF((<PyObject **> data)[0])
  17186. * else:
  17187. * refcount_objects_in_slice(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
  17188. * ndim - 1, inc)
  17189. *
  17190. */
  17191. /*else*/ {
  17192. /* "View.MemoryView":1389
  17193. * else:
  17194. * refcount_objects_in_slice(data, shape + 1, strides + 1,
  17195. * ndim - 1, inc) # <<<<<<<<<<<<<<
  17196. *
  17197. * data += strides[0]
  17198. */
  17199. __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
  17200. }
  17201. __pyx_L5:;
  17202. /* "View.MemoryView":1391
  17203. * ndim - 1, inc)
  17204. *
  17205. * data += strides[0] # <<<<<<<<<<<<<<
  17206. *
  17207. *
  17208. */
  17209. __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
  17210. }
  17211. /* "View.MemoryView":1377
  17212. *
  17213. * @cname('__pyx_memoryview_refcount_objects_in_slice')
  17214. * cdef void refcount_objects_in_slice(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  17215. * Py_ssize_t *strides, int ndim, bint inc):
  17216. * cdef Py_ssize_t i
  17217. */
  17218. /* function exit code */
  17219. __Pyx_RefNannyFinishContext();
  17220. }
  17221. /* "View.MemoryView":1397
  17222. *
  17223. * @cname('__pyx_memoryview_slice_assign_scalar')
  17224. * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
  17225. * size_t itemsize, void *item,
  17226. * bint dtype_is_object) nogil:
  17227. */
  17228. 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) {
  17229. /* "View.MemoryView":1400
  17230. * size_t itemsize, void *item,
  17231. * bint dtype_is_object) nogil:
  17232. * refcount_copying(dst, dtype_is_object, ndim, False) # <<<<<<<<<<<<<<
  17233. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
  17234. * itemsize, item)
  17235. */
  17236. __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
  17237. /* "View.MemoryView":1401
  17238. * bint dtype_is_object) nogil:
  17239. * refcount_copying(dst, dtype_is_object, ndim, False)
  17240. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim, # <<<<<<<<<<<<<<
  17241. * itemsize, item)
  17242. * refcount_copying(dst, dtype_is_object, ndim, True)
  17243. */
  17244. __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);
  17245. /* "View.MemoryView":1403
  17246. * _slice_assign_scalar(dst.data, dst.shape, dst.strides, ndim,
  17247. * itemsize, item)
  17248. * refcount_copying(dst, dtype_is_object, ndim, True) # <<<<<<<<<<<<<<
  17249. *
  17250. *
  17251. */
  17252. __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
  17253. /* "View.MemoryView":1397
  17254. *
  17255. * @cname('__pyx_memoryview_slice_assign_scalar')
  17256. * cdef void slice_assign_scalar(__Pyx_memviewslice *dst, int ndim, # <<<<<<<<<<<<<<
  17257. * size_t itemsize, void *item,
  17258. * bint dtype_is_object) nogil:
  17259. */
  17260. /* function exit code */
  17261. }
  17262. /* "View.MemoryView":1407
  17263. *
  17264. * @cname('__pyx_memoryview__slice_assign_scalar')
  17265. * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  17266. * Py_ssize_t *strides, int ndim,
  17267. * size_t itemsize, void *item) nogil:
  17268. */
  17269. 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) {
  17270. CYTHON_UNUSED Py_ssize_t __pyx_v_i;
  17271. Py_ssize_t __pyx_v_stride;
  17272. Py_ssize_t __pyx_v_extent;
  17273. int __pyx_t_1;
  17274. Py_ssize_t __pyx_t_2;
  17275. Py_ssize_t __pyx_t_3;
  17276. Py_ssize_t __pyx_t_4;
  17277. /* "View.MemoryView":1411
  17278. * size_t itemsize, void *item) nogil:
  17279. * cdef Py_ssize_t i
  17280. * cdef Py_ssize_t stride = strides[0] # <<<<<<<<<<<<<<
  17281. * cdef Py_ssize_t extent = shape[0]
  17282. *
  17283. */
  17284. __pyx_v_stride = (__pyx_v_strides[0]);
  17285. /* "View.MemoryView":1412
  17286. * cdef Py_ssize_t i
  17287. * cdef Py_ssize_t stride = strides[0]
  17288. * cdef Py_ssize_t extent = shape[0] # <<<<<<<<<<<<<<
  17289. *
  17290. * if ndim == 1:
  17291. */
  17292. __pyx_v_extent = (__pyx_v_shape[0]);
  17293. /* "View.MemoryView":1414
  17294. * cdef Py_ssize_t extent = shape[0]
  17295. *
  17296. * if ndim == 1: # <<<<<<<<<<<<<<
  17297. * for i in range(extent):
  17298. * memcpy(data, item, itemsize)
  17299. */
  17300. __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
  17301. if (__pyx_t_1) {
  17302. /* "View.MemoryView":1415
  17303. *
  17304. * if ndim == 1:
  17305. * for i in range(extent): # <<<<<<<<<<<<<<
  17306. * memcpy(data, item, itemsize)
  17307. * data += stride
  17308. */
  17309. __pyx_t_2 = __pyx_v_extent;
  17310. __pyx_t_3 = __pyx_t_2;
  17311. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  17312. __pyx_v_i = __pyx_t_4;
  17313. /* "View.MemoryView":1416
  17314. * if ndim == 1:
  17315. * for i in range(extent):
  17316. * memcpy(data, item, itemsize) # <<<<<<<<<<<<<<
  17317. * data += stride
  17318. * else:
  17319. */
  17320. (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
  17321. /* "View.MemoryView":1417
  17322. * for i in range(extent):
  17323. * memcpy(data, item, itemsize)
  17324. * data += stride # <<<<<<<<<<<<<<
  17325. * else:
  17326. * for i in range(extent):
  17327. */
  17328. __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  17329. }
  17330. /* "View.MemoryView":1414
  17331. * cdef Py_ssize_t extent = shape[0]
  17332. *
  17333. * if ndim == 1: # <<<<<<<<<<<<<<
  17334. * for i in range(extent):
  17335. * memcpy(data, item, itemsize)
  17336. */
  17337. goto __pyx_L3;
  17338. }
  17339. /* "View.MemoryView":1419
  17340. * data += stride
  17341. * else:
  17342. * for i in range(extent): # <<<<<<<<<<<<<<
  17343. * _slice_assign_scalar(data, shape + 1, strides + 1,
  17344. * ndim - 1, itemsize, item)
  17345. */
  17346. /*else*/ {
  17347. __pyx_t_2 = __pyx_v_extent;
  17348. __pyx_t_3 = __pyx_t_2;
  17349. for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
  17350. __pyx_v_i = __pyx_t_4;
  17351. /* "View.MemoryView":1420
  17352. * else:
  17353. * for i in range(extent):
  17354. * _slice_assign_scalar(data, shape + 1, strides + 1, # <<<<<<<<<<<<<<
  17355. * ndim - 1, itemsize, item)
  17356. * data += stride
  17357. */
  17358. __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);
  17359. /* "View.MemoryView":1422
  17360. * _slice_assign_scalar(data, shape + 1, strides + 1,
  17361. * ndim - 1, itemsize, item)
  17362. * data += stride # <<<<<<<<<<<<<<
  17363. *
  17364. *
  17365. */
  17366. __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
  17367. }
  17368. }
  17369. __pyx_L3:;
  17370. /* "View.MemoryView":1407
  17371. *
  17372. * @cname('__pyx_memoryview__slice_assign_scalar')
  17373. * cdef void _slice_assign_scalar(char *data, Py_ssize_t *shape, # <<<<<<<<<<<<<<
  17374. * Py_ssize_t *strides, int ndim,
  17375. * size_t itemsize, void *item) nogil:
  17376. */
  17377. /* function exit code */
  17378. }
  17379. /* "(tree fragment)":1
  17380. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  17381. * cdef object __pyx_PickleError
  17382. * cdef object __pyx_result
  17383. */
  17384. /* Python wrapper */
  17385. static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
  17386. 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};
  17387. static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  17388. PyObject *__pyx_v___pyx_type = 0;
  17389. long __pyx_v___pyx_checksum;
  17390. PyObject *__pyx_v___pyx_state = 0;
  17391. PyObject *__pyx_r = 0;
  17392. __Pyx_RefNannyDeclarations
  17393. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0);
  17394. {
  17395. static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
  17396. PyObject* values[3] = {0,0,0};
  17397. if (unlikely(__pyx_kwds)) {
  17398. Py_ssize_t kw_args;
  17399. const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
  17400. switch (pos_args) {
  17401. case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  17402. CYTHON_FALLTHROUGH;
  17403. case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  17404. CYTHON_FALLTHROUGH;
  17405. case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  17406. CYTHON_FALLTHROUGH;
  17407. case 0: break;
  17408. default: goto __pyx_L5_argtuple_error;
  17409. }
  17410. kw_args = PyDict_Size(__pyx_kwds);
  17411. switch (pos_args) {
  17412. case 0:
  17413. if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
  17414. else goto __pyx_L5_argtuple_error;
  17415. CYTHON_FALLTHROUGH;
  17416. case 1:
  17417. if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
  17418. else {
  17419. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
  17420. }
  17421. CYTHON_FALLTHROUGH;
  17422. case 2:
  17423. if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
  17424. else {
  17425. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
  17426. }
  17427. }
  17428. if (unlikely(kw_args > 0)) {
  17429. if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
  17430. }
  17431. } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
  17432. goto __pyx_L5_argtuple_error;
  17433. } else {
  17434. values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
  17435. values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
  17436. values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
  17437. }
  17438. __pyx_v___pyx_type = values[0];
  17439. __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
  17440. __pyx_v___pyx_state = values[2];
  17441. }
  17442. goto __pyx_L4_argument_unpacking_done;
  17443. __pyx_L5_argtuple_error:;
  17444. __Pyx_RaiseArgtupleInvalid("__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
  17445. __pyx_L3_error:;
  17446. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17447. __Pyx_RefNannyFinishContext();
  17448. return NULL;
  17449. __pyx_L4_argument_unpacking_done:;
  17450. __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
  17451. /* function exit code */
  17452. __Pyx_RefNannyFinishContext();
  17453. return __pyx_r;
  17454. }
  17455. 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) {
  17456. PyObject *__pyx_v___pyx_PickleError = 0;
  17457. PyObject *__pyx_v___pyx_result = 0;
  17458. PyObject *__pyx_r = NULL;
  17459. __Pyx_RefNannyDeclarations
  17460. int __pyx_t_1;
  17461. PyObject *__pyx_t_2 = NULL;
  17462. PyObject *__pyx_t_3 = NULL;
  17463. PyObject *__pyx_t_4 = NULL;
  17464. PyObject *__pyx_t_5 = NULL;
  17465. int __pyx_t_6;
  17466. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0);
  17467. /* "(tree fragment)":4
  17468. * cdef object __pyx_PickleError
  17469. * cdef object __pyx_result
  17470. * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
  17471. * from pickle import PickleError as __pyx_PickleError
  17472. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  17473. */
  17474. __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
  17475. if (__pyx_t_1) {
  17476. /* "(tree fragment)":5
  17477. * cdef object __pyx_result
  17478. * if __pyx_checksum != 0xb068931:
  17479. * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<<
  17480. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  17481. * __pyx_result = Enum.__new__(__pyx_type)
  17482. */
  17483. __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
  17484. __Pyx_GOTREF(__pyx_t_2);
  17485. __Pyx_INCREF(__pyx_n_s_PickleError);
  17486. __Pyx_GIVEREF(__pyx_n_s_PickleError);
  17487. PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
  17488. __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 5, __pyx_L1_error)
  17489. __Pyx_GOTREF(__pyx_t_3);
  17490. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17491. __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 5, __pyx_L1_error)
  17492. __Pyx_GOTREF(__pyx_t_2);
  17493. __Pyx_INCREF(__pyx_t_2);
  17494. __pyx_v___pyx_PickleError = __pyx_t_2;
  17495. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17496. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17497. /* "(tree fragment)":6
  17498. * if __pyx_checksum != 0xb068931:
  17499. * from pickle import PickleError as __pyx_PickleError
  17500. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum) # <<<<<<<<<<<<<<
  17501. * __pyx_result = Enum.__new__(__pyx_type)
  17502. * if __pyx_state is not None:
  17503. */
  17504. __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 6, __pyx_L1_error)
  17505. __Pyx_GOTREF(__pyx_t_2);
  17506. __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
  17507. __Pyx_GOTREF(__pyx_t_4);
  17508. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17509. __Pyx_INCREF(__pyx_v___pyx_PickleError);
  17510. __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
  17511. if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
  17512. __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
  17513. if (likely(__pyx_t_5)) {
  17514. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  17515. __Pyx_INCREF(__pyx_t_5);
  17516. __Pyx_INCREF(function);
  17517. __Pyx_DECREF_SET(__pyx_t_2, function);
  17518. }
  17519. }
  17520. __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);
  17521. __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
  17522. __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  17523. if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 6, __pyx_L1_error)
  17524. __Pyx_GOTREF(__pyx_t_3);
  17525. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17526. __Pyx_Raise(__pyx_t_3, 0, 0, 0);
  17527. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17528. __PYX_ERR(2, 6, __pyx_L1_error)
  17529. /* "(tree fragment)":4
  17530. * cdef object __pyx_PickleError
  17531. * cdef object __pyx_result
  17532. * if __pyx_checksum != 0xb068931: # <<<<<<<<<<<<<<
  17533. * from pickle import PickleError as __pyx_PickleError
  17534. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  17535. */
  17536. }
  17537. /* "(tree fragment)":7
  17538. * from pickle import PickleError as __pyx_PickleError
  17539. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  17540. * __pyx_result = Enum.__new__(__pyx_type) # <<<<<<<<<<<<<<
  17541. * if __pyx_state is not None:
  17542. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  17543. */
  17544. __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 7, __pyx_L1_error)
  17545. __Pyx_GOTREF(__pyx_t_2);
  17546. __pyx_t_4 = NULL;
  17547. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
  17548. __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
  17549. if (likely(__pyx_t_4)) {
  17550. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
  17551. __Pyx_INCREF(__pyx_t_4);
  17552. __Pyx_INCREF(function);
  17553. __Pyx_DECREF_SET(__pyx_t_2, function);
  17554. }
  17555. }
  17556. __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);
  17557. __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
  17558. if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 7, __pyx_L1_error)
  17559. __Pyx_GOTREF(__pyx_t_3);
  17560. __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  17561. __pyx_v___pyx_result = __pyx_t_3;
  17562. __pyx_t_3 = 0;
  17563. /* "(tree fragment)":8
  17564. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  17565. * __pyx_result = Enum.__new__(__pyx_type)
  17566. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  17567. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  17568. * return __pyx_result
  17569. */
  17570. __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
  17571. __pyx_t_6 = (__pyx_t_1 != 0);
  17572. if (__pyx_t_6) {
  17573. /* "(tree fragment)":9
  17574. * __pyx_result = Enum.__new__(__pyx_type)
  17575. * if __pyx_state is not None:
  17576. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state) # <<<<<<<<<<<<<<
  17577. * return __pyx_result
  17578. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  17579. */
  17580. 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(2, 9, __pyx_L1_error)
  17581. __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(2, 9, __pyx_L1_error)
  17582. __Pyx_GOTREF(__pyx_t_3);
  17583. __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  17584. /* "(tree fragment)":8
  17585. * raise __pyx_PickleError("Incompatible checksums (%s vs 0xb068931 = (name))" % __pyx_checksum)
  17586. * __pyx_result = Enum.__new__(__pyx_type)
  17587. * if __pyx_state is not None: # <<<<<<<<<<<<<<
  17588. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  17589. * return __pyx_result
  17590. */
  17591. }
  17592. /* "(tree fragment)":10
  17593. * if __pyx_state is not None:
  17594. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  17595. * return __pyx_result # <<<<<<<<<<<<<<
  17596. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  17597. * __pyx_result.name = __pyx_state[0]
  17598. */
  17599. __Pyx_XDECREF(__pyx_r);
  17600. __Pyx_INCREF(__pyx_v___pyx_result);
  17601. __pyx_r = __pyx_v___pyx_result;
  17602. goto __pyx_L0;
  17603. /* "(tree fragment)":1
  17604. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  17605. * cdef object __pyx_PickleError
  17606. * cdef object __pyx_result
  17607. */
  17608. /* function exit code */
  17609. __pyx_L1_error:;
  17610. __Pyx_XDECREF(__pyx_t_2);
  17611. __Pyx_XDECREF(__pyx_t_3);
  17612. __Pyx_XDECREF(__pyx_t_4);
  17613. __Pyx_XDECREF(__pyx_t_5);
  17614. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17615. __pyx_r = NULL;
  17616. __pyx_L0:;
  17617. __Pyx_XDECREF(__pyx_v___pyx_PickleError);
  17618. __Pyx_XDECREF(__pyx_v___pyx_result);
  17619. __Pyx_XGIVEREF(__pyx_r);
  17620. __Pyx_RefNannyFinishContext();
  17621. return __pyx_r;
  17622. }
  17623. /* "(tree fragment)":11
  17624. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  17625. * return __pyx_result
  17626. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  17627. * __pyx_result.name = __pyx_state[0]
  17628. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  17629. */
  17630. static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
  17631. PyObject *__pyx_r = NULL;
  17632. __Pyx_RefNannyDeclarations
  17633. PyObject *__pyx_t_1 = NULL;
  17634. int __pyx_t_2;
  17635. Py_ssize_t __pyx_t_3;
  17636. int __pyx_t_4;
  17637. int __pyx_t_5;
  17638. PyObject *__pyx_t_6 = NULL;
  17639. PyObject *__pyx_t_7 = NULL;
  17640. PyObject *__pyx_t_8 = NULL;
  17641. __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0);
  17642. /* "(tree fragment)":12
  17643. * return __pyx_result
  17644. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  17645. * __pyx_result.name = __pyx_state[0] # <<<<<<<<<<<<<<
  17646. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  17647. * __pyx_result.__dict__.update(__pyx_state[1])
  17648. */
  17649. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  17650. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  17651. __PYX_ERR(2, 12, __pyx_L1_error)
  17652. }
  17653. __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(2, 12, __pyx_L1_error)
  17654. __Pyx_GOTREF(__pyx_t_1);
  17655. __Pyx_GIVEREF(__pyx_t_1);
  17656. __Pyx_GOTREF(__pyx_v___pyx_result->name);
  17657. __Pyx_DECREF(__pyx_v___pyx_result->name);
  17658. __pyx_v___pyx_result->name = __pyx_t_1;
  17659. __pyx_t_1 = 0;
  17660. /* "(tree fragment)":13
  17661. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  17662. * __pyx_result.name = __pyx_state[0]
  17663. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  17664. * __pyx_result.__dict__.update(__pyx_state[1])
  17665. */
  17666. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  17667. PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
  17668. __PYX_ERR(2, 13, __pyx_L1_error)
  17669. }
  17670. __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
  17671. __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
  17672. if (__pyx_t_4) {
  17673. } else {
  17674. __pyx_t_2 = __pyx_t_4;
  17675. goto __pyx_L4_bool_binop_done;
  17676. }
  17677. __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_4 == ((int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
  17678. __pyx_t_5 = (__pyx_t_4 != 0);
  17679. __pyx_t_2 = __pyx_t_5;
  17680. __pyx_L4_bool_binop_done:;
  17681. if (__pyx_t_2) {
  17682. /* "(tree fragment)":14
  17683. * __pyx_result.name = __pyx_state[0]
  17684. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  17685. * __pyx_result.__dict__.update(__pyx_state[1]) # <<<<<<<<<<<<<<
  17686. */
  17687. __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
  17688. __Pyx_GOTREF(__pyx_t_6);
  17689. __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
  17690. __Pyx_GOTREF(__pyx_t_7);
  17691. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  17692. if (unlikely(__pyx_v___pyx_state == Py_None)) {
  17693. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
  17694. __PYX_ERR(2, 14, __pyx_L1_error)
  17695. }
  17696. __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(2, 14, __pyx_L1_error)
  17697. __Pyx_GOTREF(__pyx_t_6);
  17698. __pyx_t_8 = NULL;
  17699. if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
  17700. __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
  17701. if (likely(__pyx_t_8)) {
  17702. PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
  17703. __Pyx_INCREF(__pyx_t_8);
  17704. __Pyx_INCREF(function);
  17705. __Pyx_DECREF_SET(__pyx_t_7, function);
  17706. }
  17707. }
  17708. __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);
  17709. __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
  17710. __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  17711. if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
  17712. __Pyx_GOTREF(__pyx_t_1);
  17713. __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  17714. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  17715. /* "(tree fragment)":13
  17716. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state):
  17717. * __pyx_result.name = __pyx_state[0]
  17718. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<<
  17719. * __pyx_result.__dict__.update(__pyx_state[1])
  17720. */
  17721. }
  17722. /* "(tree fragment)":11
  17723. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  17724. * return __pyx_result
  17725. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  17726. * __pyx_result.name = __pyx_state[0]
  17727. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  17728. */
  17729. /* function exit code */
  17730. __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  17731. goto __pyx_L0;
  17732. __pyx_L1_error:;
  17733. __Pyx_XDECREF(__pyx_t_1);
  17734. __Pyx_XDECREF(__pyx_t_6);
  17735. __Pyx_XDECREF(__pyx_t_7);
  17736. __Pyx_XDECREF(__pyx_t_8);
  17737. __Pyx_AddTraceback("View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
  17738. __pyx_r = 0;
  17739. __pyx_L0:;
  17740. __Pyx_XGIVEREF(__pyx_r);
  17741. __Pyx_RefNannyFinishContext();
  17742. return __pyx_r;
  17743. }
  17744. static struct __pyx_vtabstruct_array __pyx_vtable_array;
  17745. static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
  17746. struct __pyx_array_obj *p;
  17747. PyObject *o;
  17748. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  17749. o = (*t->tp_alloc)(t, 0);
  17750. } else {
  17751. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  17752. }
  17753. if (unlikely(!o)) return 0;
  17754. p = ((struct __pyx_array_obj *)o);
  17755. p->__pyx_vtab = __pyx_vtabptr_array;
  17756. p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
  17757. p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
  17758. if (unlikely(__pyx_array___cinit__(o, a, k) < 0)) goto bad;
  17759. return o;
  17760. bad:
  17761. Py_DECREF(o); o = 0;
  17762. return NULL;
  17763. }
  17764. static void __pyx_tp_dealloc_array(PyObject *o) {
  17765. struct __pyx_array_obj *p = (struct __pyx_array_obj *)o;
  17766. #if CYTHON_USE_TP_FINALIZE
  17767. 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))) {
  17768. if (PyObject_CallFinalizerFromDealloc(o)) return;
  17769. }
  17770. #endif
  17771. {
  17772. PyObject *etype, *eval, *etb;
  17773. PyErr_Fetch(&etype, &eval, &etb);
  17774. ++Py_REFCNT(o);
  17775. __pyx_array___dealloc__(o);
  17776. --Py_REFCNT(o);
  17777. PyErr_Restore(etype, eval, etb);
  17778. }
  17779. Py_CLEAR(p->mode);
  17780. Py_CLEAR(p->_format);
  17781. (*Py_TYPE(o)->tp_free)(o);
  17782. }
  17783. static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
  17784. PyObject *r;
  17785. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  17786. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  17787. Py_DECREF(x);
  17788. return r;
  17789. }
  17790. static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
  17791. if (v) {
  17792. return __pyx_array___setitem__(o, i, v);
  17793. }
  17794. else {
  17795. PyErr_Format(PyExc_NotImplementedError,
  17796. "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
  17797. return -1;
  17798. }
  17799. }
  17800. static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
  17801. PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
  17802. if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  17803. PyErr_Clear();
  17804. v = __pyx_array___getattr__(o, n);
  17805. }
  17806. return v;
  17807. }
  17808. static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED void *x) {
  17809. return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
  17810. }
  17811. static PyMethodDef __pyx_methods_array[] = {
  17812. {"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
  17813. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
  17814. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
  17815. {0, 0, 0, 0}
  17816. };
  17817. static struct PyGetSetDef __pyx_getsets_array[] = {
  17818. {(char *)"memview", __pyx_getprop___pyx_array_memview, 0, (char *)0, 0},
  17819. {0, 0, 0, 0, 0}
  17820. };
  17821. static PySequenceMethods __pyx_tp_as_sequence_array = {
  17822. __pyx_array___len__, /*sq_length*/
  17823. 0, /*sq_concat*/
  17824. 0, /*sq_repeat*/
  17825. __pyx_sq_item_array, /*sq_item*/
  17826. 0, /*sq_slice*/
  17827. 0, /*sq_ass_item*/
  17828. 0, /*sq_ass_slice*/
  17829. 0, /*sq_contains*/
  17830. 0, /*sq_inplace_concat*/
  17831. 0, /*sq_inplace_repeat*/
  17832. };
  17833. static PyMappingMethods __pyx_tp_as_mapping_array = {
  17834. __pyx_array___len__, /*mp_length*/
  17835. __pyx_array___getitem__, /*mp_subscript*/
  17836. __pyx_mp_ass_subscript_array, /*mp_ass_subscript*/
  17837. };
  17838. static PyBufferProcs __pyx_tp_as_buffer_array = {
  17839. #if PY_MAJOR_VERSION < 3
  17840. 0, /*bf_getreadbuffer*/
  17841. #endif
  17842. #if PY_MAJOR_VERSION < 3
  17843. 0, /*bf_getwritebuffer*/
  17844. #endif
  17845. #if PY_MAJOR_VERSION < 3
  17846. 0, /*bf_getsegcount*/
  17847. #endif
  17848. #if PY_MAJOR_VERSION < 3
  17849. 0, /*bf_getcharbuffer*/
  17850. #endif
  17851. __pyx_array_getbuffer, /*bf_getbuffer*/
  17852. 0, /*bf_releasebuffer*/
  17853. };
  17854. static PyTypeObject __pyx_type___pyx_array = {
  17855. PyVarObject_HEAD_INIT(0, 0)
  17856. "app.trade.trade_utils.array", /*tp_name*/
  17857. sizeof(struct __pyx_array_obj), /*tp_basicsize*/
  17858. 0, /*tp_itemsize*/
  17859. __pyx_tp_dealloc_array, /*tp_dealloc*/
  17860. #if PY_VERSION_HEX < 0x030800b4
  17861. 0, /*tp_print*/
  17862. #endif
  17863. #if PY_VERSION_HEX >= 0x030800b4
  17864. 0, /*tp_vectorcall_offset*/
  17865. #endif
  17866. 0, /*tp_getattr*/
  17867. 0, /*tp_setattr*/
  17868. #if PY_MAJOR_VERSION < 3
  17869. 0, /*tp_compare*/
  17870. #endif
  17871. #if PY_MAJOR_VERSION >= 3
  17872. 0, /*tp_as_async*/
  17873. #endif
  17874. 0, /*tp_repr*/
  17875. 0, /*tp_as_number*/
  17876. &__pyx_tp_as_sequence_array, /*tp_as_sequence*/
  17877. &__pyx_tp_as_mapping_array, /*tp_as_mapping*/
  17878. 0, /*tp_hash*/
  17879. 0, /*tp_call*/
  17880. 0, /*tp_str*/
  17881. __pyx_tp_getattro_array, /*tp_getattro*/
  17882. 0, /*tp_setattro*/
  17883. &__pyx_tp_as_buffer_array, /*tp_as_buffer*/
  17884. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  17885. 0, /*tp_doc*/
  17886. 0, /*tp_traverse*/
  17887. 0, /*tp_clear*/
  17888. 0, /*tp_richcompare*/
  17889. 0, /*tp_weaklistoffset*/
  17890. 0, /*tp_iter*/
  17891. 0, /*tp_iternext*/
  17892. __pyx_methods_array, /*tp_methods*/
  17893. 0, /*tp_members*/
  17894. __pyx_getsets_array, /*tp_getset*/
  17895. 0, /*tp_base*/
  17896. 0, /*tp_dict*/
  17897. 0, /*tp_descr_get*/
  17898. 0, /*tp_descr_set*/
  17899. 0, /*tp_dictoffset*/
  17900. 0, /*tp_init*/
  17901. 0, /*tp_alloc*/
  17902. __pyx_tp_new_array, /*tp_new*/
  17903. 0, /*tp_free*/
  17904. 0, /*tp_is_gc*/
  17905. 0, /*tp_bases*/
  17906. 0, /*tp_mro*/
  17907. 0, /*tp_cache*/
  17908. 0, /*tp_subclasses*/
  17909. 0, /*tp_weaklist*/
  17910. 0, /*tp_del*/
  17911. 0, /*tp_version_tag*/
  17912. #if PY_VERSION_HEX >= 0x030400a1
  17913. 0, /*tp_finalize*/
  17914. #endif
  17915. #if PY_VERSION_HEX >= 0x030800b1
  17916. 0, /*tp_vectorcall*/
  17917. #endif
  17918. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  17919. 0, /*tp_print*/
  17920. #endif
  17921. };
  17922. static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  17923. struct __pyx_MemviewEnum_obj *p;
  17924. PyObject *o;
  17925. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  17926. o = (*t->tp_alloc)(t, 0);
  17927. } else {
  17928. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  17929. }
  17930. if (unlikely(!o)) return 0;
  17931. p = ((struct __pyx_MemviewEnum_obj *)o);
  17932. p->name = Py_None; Py_INCREF(Py_None);
  17933. return o;
  17934. }
  17935. static void __pyx_tp_dealloc_Enum(PyObject *o) {
  17936. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  17937. #if CYTHON_USE_TP_FINALIZE
  17938. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  17939. if (PyObject_CallFinalizerFromDealloc(o)) return;
  17940. }
  17941. #endif
  17942. PyObject_GC_UnTrack(o);
  17943. Py_CLEAR(p->name);
  17944. (*Py_TYPE(o)->tp_free)(o);
  17945. }
  17946. static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v, void *a) {
  17947. int e;
  17948. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  17949. if (p->name) {
  17950. e = (*v)(p->name, a); if (e) return e;
  17951. }
  17952. return 0;
  17953. }
  17954. static int __pyx_tp_clear_Enum(PyObject *o) {
  17955. PyObject* tmp;
  17956. struct __pyx_MemviewEnum_obj *p = (struct __pyx_MemviewEnum_obj *)o;
  17957. tmp = ((PyObject*)p->name);
  17958. p->name = Py_None; Py_INCREF(Py_None);
  17959. Py_XDECREF(tmp);
  17960. return 0;
  17961. }
  17962. static PyMethodDef __pyx_methods_Enum[] = {
  17963. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
  17964. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
  17965. {0, 0, 0, 0}
  17966. };
  17967. static PyTypeObject __pyx_type___pyx_MemviewEnum = {
  17968. PyVarObject_HEAD_INIT(0, 0)
  17969. "app.trade.trade_utils.Enum", /*tp_name*/
  17970. sizeof(struct __pyx_MemviewEnum_obj), /*tp_basicsize*/
  17971. 0, /*tp_itemsize*/
  17972. __pyx_tp_dealloc_Enum, /*tp_dealloc*/
  17973. #if PY_VERSION_HEX < 0x030800b4
  17974. 0, /*tp_print*/
  17975. #endif
  17976. #if PY_VERSION_HEX >= 0x030800b4
  17977. 0, /*tp_vectorcall_offset*/
  17978. #endif
  17979. 0, /*tp_getattr*/
  17980. 0, /*tp_setattr*/
  17981. #if PY_MAJOR_VERSION < 3
  17982. 0, /*tp_compare*/
  17983. #endif
  17984. #if PY_MAJOR_VERSION >= 3
  17985. 0, /*tp_as_async*/
  17986. #endif
  17987. __pyx_MemviewEnum___repr__, /*tp_repr*/
  17988. 0, /*tp_as_number*/
  17989. 0, /*tp_as_sequence*/
  17990. 0, /*tp_as_mapping*/
  17991. 0, /*tp_hash*/
  17992. 0, /*tp_call*/
  17993. 0, /*tp_str*/
  17994. 0, /*tp_getattro*/
  17995. 0, /*tp_setattro*/
  17996. 0, /*tp_as_buffer*/
  17997. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  17998. 0, /*tp_doc*/
  17999. __pyx_tp_traverse_Enum, /*tp_traverse*/
  18000. __pyx_tp_clear_Enum, /*tp_clear*/
  18001. 0, /*tp_richcompare*/
  18002. 0, /*tp_weaklistoffset*/
  18003. 0, /*tp_iter*/
  18004. 0, /*tp_iternext*/
  18005. __pyx_methods_Enum, /*tp_methods*/
  18006. 0, /*tp_members*/
  18007. 0, /*tp_getset*/
  18008. 0, /*tp_base*/
  18009. 0, /*tp_dict*/
  18010. 0, /*tp_descr_get*/
  18011. 0, /*tp_descr_set*/
  18012. 0, /*tp_dictoffset*/
  18013. __pyx_MemviewEnum___init__, /*tp_init*/
  18014. 0, /*tp_alloc*/
  18015. __pyx_tp_new_Enum, /*tp_new*/
  18016. 0, /*tp_free*/
  18017. 0, /*tp_is_gc*/
  18018. 0, /*tp_bases*/
  18019. 0, /*tp_mro*/
  18020. 0, /*tp_cache*/
  18021. 0, /*tp_subclasses*/
  18022. 0, /*tp_weaklist*/
  18023. 0, /*tp_del*/
  18024. 0, /*tp_version_tag*/
  18025. #if PY_VERSION_HEX >= 0x030400a1
  18026. 0, /*tp_finalize*/
  18027. #endif
  18028. #if PY_VERSION_HEX >= 0x030800b1
  18029. 0, /*tp_vectorcall*/
  18030. #endif
  18031. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  18032. 0, /*tp_print*/
  18033. #endif
  18034. };
  18035. static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
  18036. static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
  18037. struct __pyx_memoryview_obj *p;
  18038. PyObject *o;
  18039. if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
  18040. o = (*t->tp_alloc)(t, 0);
  18041. } else {
  18042. o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  18043. }
  18044. if (unlikely(!o)) return 0;
  18045. p = ((struct __pyx_memoryview_obj *)o);
  18046. p->__pyx_vtab = __pyx_vtabptr_memoryview;
  18047. p->obj = Py_None; Py_INCREF(Py_None);
  18048. p->_size = Py_None; Py_INCREF(Py_None);
  18049. p->_array_interface = Py_None; Py_INCREF(Py_None);
  18050. p->view.obj = NULL;
  18051. if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0)) goto bad;
  18052. return o;
  18053. bad:
  18054. Py_DECREF(o); o = 0;
  18055. return NULL;
  18056. }
  18057. static void __pyx_tp_dealloc_memoryview(PyObject *o) {
  18058. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  18059. #if CYTHON_USE_TP_FINALIZE
  18060. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  18061. if (PyObject_CallFinalizerFromDealloc(o)) return;
  18062. }
  18063. #endif
  18064. PyObject_GC_UnTrack(o);
  18065. {
  18066. PyObject *etype, *eval, *etb;
  18067. PyErr_Fetch(&etype, &eval, &etb);
  18068. ++Py_REFCNT(o);
  18069. __pyx_memoryview___dealloc__(o);
  18070. --Py_REFCNT(o);
  18071. PyErr_Restore(etype, eval, etb);
  18072. }
  18073. Py_CLEAR(p->obj);
  18074. Py_CLEAR(p->_size);
  18075. Py_CLEAR(p->_array_interface);
  18076. (*Py_TYPE(o)->tp_free)(o);
  18077. }
  18078. static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v, void *a) {
  18079. int e;
  18080. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  18081. if (p->obj) {
  18082. e = (*v)(p->obj, a); if (e) return e;
  18083. }
  18084. if (p->_size) {
  18085. e = (*v)(p->_size, a); if (e) return e;
  18086. }
  18087. if (p->_array_interface) {
  18088. e = (*v)(p->_array_interface, a); if (e) return e;
  18089. }
  18090. if (p->view.obj) {
  18091. e = (*v)(p->view.obj, a); if (e) return e;
  18092. }
  18093. return 0;
  18094. }
  18095. static int __pyx_tp_clear_memoryview(PyObject *o) {
  18096. PyObject* tmp;
  18097. struct __pyx_memoryview_obj *p = (struct __pyx_memoryview_obj *)o;
  18098. tmp = ((PyObject*)p->obj);
  18099. p->obj = Py_None; Py_INCREF(Py_None);
  18100. Py_XDECREF(tmp);
  18101. tmp = ((PyObject*)p->_size);
  18102. p->_size = Py_None; Py_INCREF(Py_None);
  18103. Py_XDECREF(tmp);
  18104. tmp = ((PyObject*)p->_array_interface);
  18105. p->_array_interface = Py_None; Py_INCREF(Py_None);
  18106. Py_XDECREF(tmp);
  18107. Py_CLEAR(p->view.obj);
  18108. return 0;
  18109. }
  18110. static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
  18111. PyObject *r;
  18112. PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  18113. r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
  18114. Py_DECREF(x);
  18115. return r;
  18116. }
  18117. static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
  18118. if (v) {
  18119. return __pyx_memoryview___setitem__(o, i, v);
  18120. }
  18121. else {
  18122. PyErr_Format(PyExc_NotImplementedError,
  18123. "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
  18124. return -1;
  18125. }
  18126. }
  18127. static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED void *x) {
  18128. return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
  18129. }
  18130. static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED void *x) {
  18131. return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
  18132. }
  18133. static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED void *x) {
  18134. return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
  18135. }
  18136. static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED void *x) {
  18137. return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
  18138. }
  18139. static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED void *x) {
  18140. return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
  18141. }
  18142. static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED void *x) {
  18143. return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
  18144. }
  18145. static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED void *x) {
  18146. return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
  18147. }
  18148. static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED void *x) {
  18149. return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
  18150. }
  18151. static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED void *x) {
  18152. return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
  18153. }
  18154. static PyMethodDef __pyx_methods_memoryview[] = {
  18155. {"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
  18156. {"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
  18157. {"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
  18158. {"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
  18159. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
  18160. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
  18161. {0, 0, 0, 0}
  18162. };
  18163. static struct PyGetSetDef __pyx_getsets_memoryview[] = {
  18164. {(char *)"T", __pyx_getprop___pyx_memoryview_T, 0, (char *)0, 0},
  18165. {(char *)"base", __pyx_getprop___pyx_memoryview_base, 0, (char *)0, 0},
  18166. {(char *)"shape", __pyx_getprop___pyx_memoryview_shape, 0, (char *)0, 0},
  18167. {(char *)"strides", __pyx_getprop___pyx_memoryview_strides, 0, (char *)0, 0},
  18168. {(char *)"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (char *)0, 0},
  18169. {(char *)"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (char *)0, 0},
  18170. {(char *)"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (char *)0, 0},
  18171. {(char *)"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (char *)0, 0},
  18172. {(char *)"size", __pyx_getprop___pyx_memoryview_size, 0, (char *)0, 0},
  18173. {0, 0, 0, 0, 0}
  18174. };
  18175. static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
  18176. __pyx_memoryview___len__, /*sq_length*/
  18177. 0, /*sq_concat*/
  18178. 0, /*sq_repeat*/
  18179. __pyx_sq_item_memoryview, /*sq_item*/
  18180. 0, /*sq_slice*/
  18181. 0, /*sq_ass_item*/
  18182. 0, /*sq_ass_slice*/
  18183. 0, /*sq_contains*/
  18184. 0, /*sq_inplace_concat*/
  18185. 0, /*sq_inplace_repeat*/
  18186. };
  18187. static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
  18188. __pyx_memoryview___len__, /*mp_length*/
  18189. __pyx_memoryview___getitem__, /*mp_subscript*/
  18190. __pyx_mp_ass_subscript_memoryview, /*mp_ass_subscript*/
  18191. };
  18192. static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
  18193. #if PY_MAJOR_VERSION < 3
  18194. 0, /*bf_getreadbuffer*/
  18195. #endif
  18196. #if PY_MAJOR_VERSION < 3
  18197. 0, /*bf_getwritebuffer*/
  18198. #endif
  18199. #if PY_MAJOR_VERSION < 3
  18200. 0, /*bf_getsegcount*/
  18201. #endif
  18202. #if PY_MAJOR_VERSION < 3
  18203. 0, /*bf_getcharbuffer*/
  18204. #endif
  18205. __pyx_memoryview_getbuffer, /*bf_getbuffer*/
  18206. 0, /*bf_releasebuffer*/
  18207. };
  18208. static PyTypeObject __pyx_type___pyx_memoryview = {
  18209. PyVarObject_HEAD_INIT(0, 0)
  18210. "app.trade.trade_utils.memoryview", /*tp_name*/
  18211. sizeof(struct __pyx_memoryview_obj), /*tp_basicsize*/
  18212. 0, /*tp_itemsize*/
  18213. __pyx_tp_dealloc_memoryview, /*tp_dealloc*/
  18214. #if PY_VERSION_HEX < 0x030800b4
  18215. 0, /*tp_print*/
  18216. #endif
  18217. #if PY_VERSION_HEX >= 0x030800b4
  18218. 0, /*tp_vectorcall_offset*/
  18219. #endif
  18220. 0, /*tp_getattr*/
  18221. 0, /*tp_setattr*/
  18222. #if PY_MAJOR_VERSION < 3
  18223. 0, /*tp_compare*/
  18224. #endif
  18225. #if PY_MAJOR_VERSION >= 3
  18226. 0, /*tp_as_async*/
  18227. #endif
  18228. __pyx_memoryview___repr__, /*tp_repr*/
  18229. 0, /*tp_as_number*/
  18230. &__pyx_tp_as_sequence_memoryview, /*tp_as_sequence*/
  18231. &__pyx_tp_as_mapping_memoryview, /*tp_as_mapping*/
  18232. 0, /*tp_hash*/
  18233. 0, /*tp_call*/
  18234. __pyx_memoryview___str__, /*tp_str*/
  18235. 0, /*tp_getattro*/
  18236. 0, /*tp_setattro*/
  18237. &__pyx_tp_as_buffer_memoryview, /*tp_as_buffer*/
  18238. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  18239. 0, /*tp_doc*/
  18240. __pyx_tp_traverse_memoryview, /*tp_traverse*/
  18241. __pyx_tp_clear_memoryview, /*tp_clear*/
  18242. 0, /*tp_richcompare*/
  18243. 0, /*tp_weaklistoffset*/
  18244. 0, /*tp_iter*/
  18245. 0, /*tp_iternext*/
  18246. __pyx_methods_memoryview, /*tp_methods*/
  18247. 0, /*tp_members*/
  18248. __pyx_getsets_memoryview, /*tp_getset*/
  18249. 0, /*tp_base*/
  18250. 0, /*tp_dict*/
  18251. 0, /*tp_descr_get*/
  18252. 0, /*tp_descr_set*/
  18253. 0, /*tp_dictoffset*/
  18254. 0, /*tp_init*/
  18255. 0, /*tp_alloc*/
  18256. __pyx_tp_new_memoryview, /*tp_new*/
  18257. 0, /*tp_free*/
  18258. 0, /*tp_is_gc*/
  18259. 0, /*tp_bases*/
  18260. 0, /*tp_mro*/
  18261. 0, /*tp_cache*/
  18262. 0, /*tp_subclasses*/
  18263. 0, /*tp_weaklist*/
  18264. 0, /*tp_del*/
  18265. 0, /*tp_version_tag*/
  18266. #if PY_VERSION_HEX >= 0x030400a1
  18267. 0, /*tp_finalize*/
  18268. #endif
  18269. #if PY_VERSION_HEX >= 0x030800b1
  18270. 0, /*tp_vectorcall*/
  18271. #endif
  18272. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  18273. 0, /*tp_print*/
  18274. #endif
  18275. };
  18276. static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
  18277. static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
  18278. struct __pyx_memoryviewslice_obj *p;
  18279. PyObject *o = __pyx_tp_new_memoryview(t, a, k);
  18280. if (unlikely(!o)) return 0;
  18281. p = ((struct __pyx_memoryviewslice_obj *)o);
  18282. p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
  18283. p->from_object = Py_None; Py_INCREF(Py_None);
  18284. p->from_slice.memview = NULL;
  18285. return o;
  18286. }
  18287. static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
  18288. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  18289. #if CYTHON_USE_TP_FINALIZE
  18290. if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
  18291. if (PyObject_CallFinalizerFromDealloc(o)) return;
  18292. }
  18293. #endif
  18294. PyObject_GC_UnTrack(o);
  18295. {
  18296. PyObject *etype, *eval, *etb;
  18297. PyErr_Fetch(&etype, &eval, &etb);
  18298. ++Py_REFCNT(o);
  18299. __pyx_memoryviewslice___dealloc__(o);
  18300. --Py_REFCNT(o);
  18301. PyErr_Restore(etype, eval, etb);
  18302. }
  18303. Py_CLEAR(p->from_object);
  18304. PyObject_GC_Track(o);
  18305. __pyx_tp_dealloc_memoryview(o);
  18306. }
  18307. static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v, void *a) {
  18308. int e;
  18309. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  18310. e = __pyx_tp_traverse_memoryview(o, v, a); if (e) return e;
  18311. if (p->from_object) {
  18312. e = (*v)(p->from_object, a); if (e) return e;
  18313. }
  18314. return 0;
  18315. }
  18316. static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
  18317. PyObject* tmp;
  18318. struct __pyx_memoryviewslice_obj *p = (struct __pyx_memoryviewslice_obj *)o;
  18319. __pyx_tp_clear_memoryview(o);
  18320. tmp = ((PyObject*)p->from_object);
  18321. p->from_object = Py_None; Py_INCREF(Py_None);
  18322. Py_XDECREF(tmp);
  18323. __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
  18324. return 0;
  18325. }
  18326. static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED void *x) {
  18327. return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
  18328. }
  18329. static PyMethodDef __pyx_methods__memoryviewslice[] = {
  18330. {"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
  18331. {"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
  18332. {0, 0, 0, 0}
  18333. };
  18334. static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
  18335. {(char *)"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (char *)0, 0},
  18336. {0, 0, 0, 0, 0}
  18337. };
  18338. static PyTypeObject __pyx_type___pyx_memoryviewslice = {
  18339. PyVarObject_HEAD_INIT(0, 0)
  18340. "app.trade.trade_utils._memoryviewslice", /*tp_name*/
  18341. sizeof(struct __pyx_memoryviewslice_obj), /*tp_basicsize*/
  18342. 0, /*tp_itemsize*/
  18343. __pyx_tp_dealloc__memoryviewslice, /*tp_dealloc*/
  18344. #if PY_VERSION_HEX < 0x030800b4
  18345. 0, /*tp_print*/
  18346. #endif
  18347. #if PY_VERSION_HEX >= 0x030800b4
  18348. 0, /*tp_vectorcall_offset*/
  18349. #endif
  18350. 0, /*tp_getattr*/
  18351. 0, /*tp_setattr*/
  18352. #if PY_MAJOR_VERSION < 3
  18353. 0, /*tp_compare*/
  18354. #endif
  18355. #if PY_MAJOR_VERSION >= 3
  18356. 0, /*tp_as_async*/
  18357. #endif
  18358. #if CYTHON_COMPILING_IN_PYPY
  18359. __pyx_memoryview___repr__, /*tp_repr*/
  18360. #else
  18361. 0, /*tp_repr*/
  18362. #endif
  18363. 0, /*tp_as_number*/
  18364. 0, /*tp_as_sequence*/
  18365. 0, /*tp_as_mapping*/
  18366. 0, /*tp_hash*/
  18367. 0, /*tp_call*/
  18368. #if CYTHON_COMPILING_IN_PYPY
  18369. __pyx_memoryview___str__, /*tp_str*/
  18370. #else
  18371. 0, /*tp_str*/
  18372. #endif
  18373. 0, /*tp_getattro*/
  18374. 0, /*tp_setattro*/
  18375. 0, /*tp_as_buffer*/
  18376. Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  18377. "Internal class for passing memoryview slices to Python", /*tp_doc*/
  18378. __pyx_tp_traverse__memoryviewslice, /*tp_traverse*/
  18379. __pyx_tp_clear__memoryviewslice, /*tp_clear*/
  18380. 0, /*tp_richcompare*/
  18381. 0, /*tp_weaklistoffset*/
  18382. 0, /*tp_iter*/
  18383. 0, /*tp_iternext*/
  18384. __pyx_methods__memoryviewslice, /*tp_methods*/
  18385. 0, /*tp_members*/
  18386. __pyx_getsets__memoryviewslice, /*tp_getset*/
  18387. 0, /*tp_base*/
  18388. 0, /*tp_dict*/
  18389. 0, /*tp_descr_get*/
  18390. 0, /*tp_descr_set*/
  18391. 0, /*tp_dictoffset*/
  18392. 0, /*tp_init*/
  18393. 0, /*tp_alloc*/
  18394. __pyx_tp_new__memoryviewslice, /*tp_new*/
  18395. 0, /*tp_free*/
  18396. 0, /*tp_is_gc*/
  18397. 0, /*tp_bases*/
  18398. 0, /*tp_mro*/
  18399. 0, /*tp_cache*/
  18400. 0, /*tp_subclasses*/
  18401. 0, /*tp_weaklist*/
  18402. 0, /*tp_del*/
  18403. 0, /*tp_version_tag*/
  18404. #if PY_VERSION_HEX >= 0x030400a1
  18405. 0, /*tp_finalize*/
  18406. #endif
  18407. #if PY_VERSION_HEX >= 0x030800b1
  18408. 0, /*tp_vectorcall*/
  18409. #endif
  18410. #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
  18411. 0, /*tp_print*/
  18412. #endif
  18413. };
  18414. static PyMethodDef __pyx_methods[] = {
  18415. {"update_export_partner", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_3app_5trade_11trade_utils_3update_export_partner, METH_VARARGS|METH_KEYWORDS, 0},
  18416. {0, 0, 0, 0}
  18417. };
  18418. #if PY_MAJOR_VERSION >= 3
  18419. #if CYTHON_PEP489_MULTI_PHASE_INIT
  18420. static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
  18421. static int __pyx_pymod_exec_trade_utils(PyObject* module); /*proto*/
  18422. static PyModuleDef_Slot __pyx_moduledef_slots[] = {
  18423. {Py_mod_create, (void*)__pyx_pymod_create},
  18424. {Py_mod_exec, (void*)__pyx_pymod_exec_trade_utils},
  18425. {0, NULL}
  18426. };
  18427. #endif
  18428. static struct PyModuleDef __pyx_moduledef = {
  18429. PyModuleDef_HEAD_INIT,
  18430. "trade_utils",
  18431. 0, /* m_doc */
  18432. #if CYTHON_PEP489_MULTI_PHASE_INIT
  18433. 0, /* m_size */
  18434. #else
  18435. -1, /* m_size */
  18436. #endif
  18437. __pyx_methods /* m_methods */,
  18438. #if CYTHON_PEP489_MULTI_PHASE_INIT
  18439. __pyx_moduledef_slots, /* m_slots */
  18440. #else
  18441. NULL, /* m_reload */
  18442. #endif
  18443. NULL, /* m_traverse */
  18444. NULL, /* m_clear */
  18445. NULL /* m_free */
  18446. };
  18447. #endif
  18448. #ifndef CYTHON_SMALL_CODE
  18449. #if defined(__clang__)
  18450. #define CYTHON_SMALL_CODE
  18451. #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
  18452. #define CYTHON_SMALL_CODE __attribute__((cold))
  18453. #else
  18454. #define CYTHON_SMALL_CODE
  18455. #endif
  18456. #endif
  18457. static __Pyx_StringTabEntry __pyx_string_tab[] = {
  18458. {&__pyx_n_s_ASCII, __pyx_k_ASCII, sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
  18459. {&__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},
  18460. {&__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},
  18461. {&__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},
  18462. {&__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},
  18463. {&__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},
  18464. {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis, sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
  18465. {&__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},
  18466. {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
  18467. {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
  18468. {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  18469. {&__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},
  18470. {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
  18471. {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
  18472. {&__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},
  18473. {&__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},
  18474. {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
  18475. {&__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},
  18476. {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object, sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
  18477. {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
  18478. {&__pyx_n_b_O, __pyx_k_O, sizeof(__pyx_k_O), 0, 0, 0, 1},
  18479. {&__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},
  18480. {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
  18481. {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
  18482. {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
  18483. {&__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},
  18484. {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
  18485. {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView, sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
  18486. {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer, sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
  18487. {&__pyx_n_s_app_trade_trade_utils, __pyx_k_app_trade_trade_utils, sizeof(__pyx_k_app_trade_trade_utils), 0, 0, 1, 1},
  18488. {&__pyx_kp_s_app_trade_trade_utils_pyx, __pyx_k_app_trade_trade_utils_pyx, sizeof(__pyx_k_app_trade_trade_utils_pyx), 0, 0, 1, 0},
  18489. {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
  18490. {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
  18491. {&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
  18492. {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
  18493. {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
  18494. {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct, sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
  18495. {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect, sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
  18496. {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1},
  18497. {&__pyx_n_s_distance, __pyx_k_distance, sizeof(__pyx_k_distance), 0, 0, 1, 1},
  18498. {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
  18499. {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object, sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
  18500. {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  18501. {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  18502. {&__pyx_n_s_error, __pyx_k_error, sizeof(__pyx_k_error), 0, 0, 1, 1},
  18503. {&__pyx_n_s_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 0, 0, 1, 1},
  18504. {&__pyx_n_s_export_partner, __pyx_k_export_partner, sizeof(__pyx_k_export_partner), 0, 0, 1, 1},
  18505. {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1},
  18506. {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  18507. {&__pyx_n_s_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 0, 1, 1},
  18508. {&__pyx_n_u_fortran, __pyx_k_fortran, sizeof(__pyx_k_fortran), 0, 1, 0, 1},
  18509. {&__pyx_n_s_full, __pyx_k_full, sizeof(__pyx_k_full), 0, 0, 1, 1},
  18510. {&__pyx_n_s_full_like, __pyx_k_full_like, sizeof(__pyx_k_full_like), 0, 0, 1, 1},
  18511. {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
  18512. {&__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},
  18513. {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
  18514. {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
  18515. {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  18516. {&__pyx_n_s_int32, __pyx_k_int32, sizeof(__pyx_k_int32), 0, 0, 1, 1},
  18517. {&__pyx_n_s_int8, __pyx_k_int8, sizeof(__pyx_k_int8), 0, 0, 1, 1},
  18518. {&__pyx_n_s_itemsize, __pyx_k_itemsize, sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
  18519. {&__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},
  18520. {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
  18521. {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  18522. {&__pyx_n_s_memview, __pyx_k_memview, sizeof(__pyx_k_memview), 0, 0, 1, 1},
  18523. {&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
  18524. {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  18525. {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
  18526. {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
  18527. {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
  18528. {&__pyx_n_s_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 0, 0, 1, 1},
  18529. {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
  18530. {&__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},
  18531. {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
  18532. {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
  18533. {&__pyx_kp_u_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 1, 0, 0},
  18534. {&__pyx_kp_u_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 1, 0, 0},
  18535. {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
  18536. {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1},
  18537. {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1},
  18538. {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
  18539. {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
  18540. {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer, sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
  18541. {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
  18542. {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
  18543. {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
  18544. {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum, sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
  18545. {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
  18546. {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  18547. {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
  18548. {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
  18549. {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
  18550. {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
  18551. {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
  18552. {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
  18553. {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
  18554. {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1},
  18555. {&__pyx_n_s_step, __pyx_k_step, sizeof(__pyx_k_step), 0, 0, 1, 1},
  18556. {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1},
  18557. {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct, sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
  18558. {&__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},
  18559. {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect, sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
  18560. {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
  18561. {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1},
  18562. {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  18563. {&__pyx_n_s_trade_distance, __pyx_k_trade_distance, sizeof(__pyx_k_trade_distance), 0, 0, 1, 1},
  18564. {&__pyx_n_s_trade_range, __pyx_k_trade_range, sizeof(__pyx_k_trade_range), 0, 0, 1, 1},
  18565. {&__pyx_n_s_trade_traversal_cost, __pyx_k_trade_traversal_cost, sizeof(__pyx_k_trade_traversal_cost), 0, 0, 1, 1},
  18566. {&__pyx_n_s_trade_value, __pyx_k_trade_value, sizeof(__pyx_k_trade_value), 0, 0, 1, 1},
  18567. {&__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},
  18568. {&__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},
  18569. {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
  18570. {&__pyx_n_s_unpack, __pyx_k_unpack, sizeof(__pyx_k_unpack), 0, 0, 1, 1},
  18571. {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1},
  18572. {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
  18573. {0, 0, 0, 0, 0, 0, 0}
  18574. };
  18575. static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  18576. __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 70, __pyx_L1_error)
  18577. __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 272, __pyx_L1_error)
  18578. __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 856, __pyx_L1_error)
  18579. __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 1038, __pyx_L1_error)
  18580. __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 148, __pyx_L1_error)
  18581. __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(2, 151, __pyx_L1_error)
  18582. __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(2, 2, __pyx_L1_error)
  18583. __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis); if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 404, __pyx_L1_error)
  18584. __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(2, 613, __pyx_L1_error)
  18585. __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError); if (!__pyx_builtin_IndexError) __PYX_ERR(2, 832, __pyx_L1_error)
  18586. return 0;
  18587. __pyx_L1_error:;
  18588. return -1;
  18589. }
  18590. static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  18591. __Pyx_RefNannyDeclarations
  18592. __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
  18593. /* "app/trade/trade_utils.pyx":51
  18594. * cdef float exp_val = 0
  18595. * cdef float dist, dist_tmp
  18596. * cdef int[:, :] neighbors = np.zeros((6,2), dtype=np.int32) # <<<<<<<<<<<<<<
  18597. *
  18598. * cdef char[:, :] visited = np.full((trade_traversal_cost.shape[0], trade_traversal_cost.shape[1]),
  18599. */
  18600. __pyx_tuple_ = PyTuple_Pack(2, __pyx_int_6, __pyx_int_2); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 51, __pyx_L1_error)
  18601. __Pyx_GOTREF(__pyx_tuple_);
  18602. __Pyx_GIVEREF(__pyx_tuple_);
  18603. __pyx_tuple__2 = PyTuple_Pack(1, __pyx_tuple_); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 51, __pyx_L1_error)
  18604. __Pyx_GOTREF(__pyx_tuple__2);
  18605. __Pyx_GIVEREF(__pyx_tuple__2);
  18606. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":272
  18607. * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
  18608. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_C_CONTIGUOUS)):
  18609. * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
  18610. *
  18611. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  18612. */
  18613. __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 272, __pyx_L1_error)
  18614. __Pyx_GOTREF(__pyx_tuple__3);
  18615. __Pyx_GIVEREF(__pyx_tuple__3);
  18616. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":276
  18617. * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
  18618. * and not PyArray_CHKFLAGS(self, NPY_ARRAY_F_CONTIGUOUS)):
  18619. * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
  18620. *
  18621. * info.buf = PyArray_DATA(self)
  18622. */
  18623. __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 276, __pyx_L1_error)
  18624. __Pyx_GOTREF(__pyx_tuple__4);
  18625. __Pyx_GIVEREF(__pyx_tuple__4);
  18626. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":306
  18627. * if ((descr.byteorder == c'>' and little_endian) or
  18628. * (descr.byteorder == c'<' and not little_endian)):
  18629. * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
  18630. * if t == NPY_BYTE: f = "b"
  18631. * elif t == NPY_UBYTE: f = "B"
  18632. */
  18633. __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 306, __pyx_L1_error)
  18634. __Pyx_GOTREF(__pyx_tuple__5);
  18635. __Pyx_GIVEREF(__pyx_tuple__5);
  18636. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":856
  18637. *
  18638. * if (end - f) - <int>(new_offset - offset[0]) < 15:
  18639. * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
  18640. *
  18641. * if ((child.byteorder == c'>' and little_endian) or
  18642. */
  18643. __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 856, __pyx_L1_error)
  18644. __Pyx_GOTREF(__pyx_tuple__6);
  18645. __Pyx_GIVEREF(__pyx_tuple__6);
  18646. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":880
  18647. * t = child.type_num
  18648. * if end - f < 5:
  18649. * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
  18650. *
  18651. * # Until ticket #99 is fixed, use integers to avoid warnings
  18652. */
  18653. __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 880, __pyx_L1_error)
  18654. __Pyx_GOTREF(__pyx_tuple__7);
  18655. __Pyx_GIVEREF(__pyx_tuple__7);
  18656. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1038
  18657. * _import_array()
  18658. * except Exception:
  18659. * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
  18660. *
  18661. * cdef inline int import_umath() except -1:
  18662. */
  18663. __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 1038, __pyx_L1_error)
  18664. __Pyx_GOTREF(__pyx_tuple__8);
  18665. __Pyx_GIVEREF(__pyx_tuple__8);
  18666. /* "../../.virtualenvs/cocostrat/lib/python3.8/site-packages/Cython/Includes/numpy/__init__.pxd":1044
  18667. * _import_umath()
  18668. * except Exception:
  18669. * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
  18670. *
  18671. * cdef inline int import_ufunc() except -1:
  18672. */
  18673. __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_u_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 1044, __pyx_L1_error)
  18674. __Pyx_GOTREF(__pyx_tuple__9);
  18675. __Pyx_GIVEREF(__pyx_tuple__9);
  18676. /* "View.MemoryView":133
  18677. *
  18678. * if not self.ndim:
  18679. * raise ValueError("Empty shape tuple for cython.array") # <<<<<<<<<<<<<<
  18680. *
  18681. * if itemsize <= 0:
  18682. */
  18683. __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 133, __pyx_L1_error)
  18684. __Pyx_GOTREF(__pyx_tuple__10);
  18685. __Pyx_GIVEREF(__pyx_tuple__10);
  18686. /* "View.MemoryView":136
  18687. *
  18688. * if itemsize <= 0:
  18689. * raise ValueError("itemsize <= 0 for cython.array") # <<<<<<<<<<<<<<
  18690. *
  18691. * if not isinstance(format, bytes):
  18692. */
  18693. __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 136, __pyx_L1_error)
  18694. __Pyx_GOTREF(__pyx_tuple__11);
  18695. __Pyx_GIVEREF(__pyx_tuple__11);
  18696. /* "View.MemoryView":148
  18697. *
  18698. * if not self._shape:
  18699. * raise MemoryError("unable to allocate shape and strides.") # <<<<<<<<<<<<<<
  18700. *
  18701. *
  18702. */
  18703. __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 148, __pyx_L1_error)
  18704. __Pyx_GOTREF(__pyx_tuple__12);
  18705. __Pyx_GIVEREF(__pyx_tuple__12);
  18706. /* "View.MemoryView":176
  18707. * self.data = <char *>malloc(self.len)
  18708. * if not self.data:
  18709. * raise MemoryError("unable to allocate array data.") # <<<<<<<<<<<<<<
  18710. *
  18711. * if self.dtype_is_object:
  18712. */
  18713. __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 176, __pyx_L1_error)
  18714. __Pyx_GOTREF(__pyx_tuple__13);
  18715. __Pyx_GIVEREF(__pyx_tuple__13);
  18716. /* "View.MemoryView":192
  18717. * bufmode = PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS
  18718. * if not (flags & bufmode):
  18719. * raise ValueError("Can only create a buffer that is contiguous in memory.") # <<<<<<<<<<<<<<
  18720. * info.buf = self.data
  18721. * info.len = self.len
  18722. */
  18723. __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 192, __pyx_L1_error)
  18724. __Pyx_GOTREF(__pyx_tuple__14);
  18725. __Pyx_GIVEREF(__pyx_tuple__14);
  18726. /* "(tree fragment)":2
  18727. * def __reduce_cython__(self):
  18728. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  18729. * def __setstate_cython__(self, __pyx_state):
  18730. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  18731. */
  18732. __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 2, __pyx_L1_error)
  18733. __Pyx_GOTREF(__pyx_tuple__15);
  18734. __Pyx_GIVEREF(__pyx_tuple__15);
  18735. /* "(tree fragment)":4
  18736. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  18737. * def __setstate_cython__(self, __pyx_state):
  18738. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  18739. */
  18740. __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 4, __pyx_L1_error)
  18741. __Pyx_GOTREF(__pyx_tuple__16);
  18742. __Pyx_GIVEREF(__pyx_tuple__16);
  18743. /* "View.MemoryView":418
  18744. * def __setitem__(memoryview self, object index, object value):
  18745. * if self.view.readonly:
  18746. * raise TypeError("Cannot assign to read-only memoryview") # <<<<<<<<<<<<<<
  18747. *
  18748. * have_slices, index = _unellipsify(index, self.view.ndim)
  18749. */
  18750. __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(2, 418, __pyx_L1_error)
  18751. __Pyx_GOTREF(__pyx_tuple__17);
  18752. __Pyx_GIVEREF(__pyx_tuple__17);
  18753. /* "View.MemoryView":495
  18754. * result = struct.unpack(self.view.format, bytesitem)
  18755. * except struct.error:
  18756. * raise ValueError("Unable to convert item to object") # <<<<<<<<<<<<<<
  18757. * else:
  18758. * if len(self.view.format) == 1:
  18759. */
  18760. __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 495, __pyx_L1_error)
  18761. __Pyx_GOTREF(__pyx_tuple__18);
  18762. __Pyx_GIVEREF(__pyx_tuple__18);
  18763. /* "View.MemoryView":520
  18764. * def __getbuffer__(self, Py_buffer *info, int flags):
  18765. * if flags & PyBUF_WRITABLE and self.view.readonly:
  18766. * raise ValueError("Cannot create writable memory view from read-only memoryview") # <<<<<<<<<<<<<<
  18767. *
  18768. * if flags & PyBUF_ND:
  18769. */
  18770. __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 520, __pyx_L1_error)
  18771. __Pyx_GOTREF(__pyx_tuple__19);
  18772. __Pyx_GIVEREF(__pyx_tuple__19);
  18773. /* "View.MemoryView":570
  18774. * if self.view.strides == NULL:
  18775. *
  18776. * raise ValueError("Buffer view does not expose strides") # <<<<<<<<<<<<<<
  18777. *
  18778. * return tuple([stride for stride in self.view.strides[:self.view.ndim]])
  18779. */
  18780. __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 570, __pyx_L1_error)
  18781. __Pyx_GOTREF(__pyx_tuple__20);
  18782. __Pyx_GIVEREF(__pyx_tuple__20);
  18783. /* "View.MemoryView":577
  18784. * def suboffsets(self):
  18785. * if self.view.suboffsets == NULL:
  18786. * return (-1,) * self.view.ndim # <<<<<<<<<<<<<<
  18787. *
  18788. * return tuple([suboffset for suboffset in self.view.suboffsets[:self.view.ndim]])
  18789. */
  18790. __pyx_tuple__21 = PyTuple_New(1); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(2, 577, __pyx_L1_error)
  18791. __Pyx_GOTREF(__pyx_tuple__21);
  18792. __Pyx_INCREF(__pyx_int_neg_1);
  18793. __Pyx_GIVEREF(__pyx_int_neg_1);
  18794. PyTuple_SET_ITEM(__pyx_tuple__21, 0, __pyx_int_neg_1);
  18795. __Pyx_GIVEREF(__pyx_tuple__21);
  18796. /* "(tree fragment)":2
  18797. * def __reduce_cython__(self):
  18798. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  18799. * def __setstate_cython__(self, __pyx_state):
  18800. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  18801. */
  18802. __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 2, __pyx_L1_error)
  18803. __Pyx_GOTREF(__pyx_tuple__22);
  18804. __Pyx_GIVEREF(__pyx_tuple__22);
  18805. /* "(tree fragment)":4
  18806. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  18807. * def __setstate_cython__(self, __pyx_state):
  18808. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  18809. */
  18810. __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(2, 4, __pyx_L1_error)
  18811. __Pyx_GOTREF(__pyx_tuple__23);
  18812. __Pyx_GIVEREF(__pyx_tuple__23);
  18813. /* "View.MemoryView":682
  18814. * if item is Ellipsis:
  18815. * if not seen_ellipsis:
  18816. * result.extend([slice(None)] * (ndim - len(tup) + 1)) # <<<<<<<<<<<<<<
  18817. * seen_ellipsis = True
  18818. * else:
  18819. */
  18820. __pyx_slice__24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__24)) __PYX_ERR(2, 682, __pyx_L1_error)
  18821. __Pyx_GOTREF(__pyx_slice__24);
  18822. __Pyx_GIVEREF(__pyx_slice__24);
  18823. /* "View.MemoryView":703
  18824. * for suboffset in suboffsets[:ndim]:
  18825. * if suboffset >= 0:
  18826. * raise ValueError("Indirect dimensions not supported") # <<<<<<<<<<<<<<
  18827. *
  18828. *
  18829. */
  18830. __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 703, __pyx_L1_error)
  18831. __Pyx_GOTREF(__pyx_tuple__25);
  18832. __Pyx_GIVEREF(__pyx_tuple__25);
  18833. /* "(tree fragment)":2
  18834. * def __reduce_cython__(self):
  18835. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  18836. * def __setstate_cython__(self, __pyx_state):
  18837. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  18838. */
  18839. __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 2, __pyx_L1_error)
  18840. __Pyx_GOTREF(__pyx_tuple__26);
  18841. __Pyx_GIVEREF(__pyx_tuple__26);
  18842. /* "(tree fragment)":4
  18843. * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
  18844. * def __setstate_cython__(self, __pyx_state):
  18845. * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
  18846. */
  18847. __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 4, __pyx_L1_error)
  18848. __Pyx_GOTREF(__pyx_tuple__27);
  18849. __Pyx_GIVEREF(__pyx_tuple__27);
  18850. /* "app/trade/trade_utils.pyx":83
  18851. *
  18852. *
  18853. * def trade_distance(int i, int j, float trade_range, trade_traversal_cost: np.ndarray, trade_value: np.ndarray): # <<<<<<<<<<<<<<
  18854. * distance = np.full_like(trade_traversal_cost, -1)
  18855. * exp = _trade_distance(i, j, trade_range, trade_traversal_cost, trade_value, distance)
  18856. */
  18857. __pyx_tuple__28 = PyTuple_Pack(7, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_trade_range, __pyx_n_s_trade_traversal_cost, __pyx_n_s_trade_value, __pyx_n_s_distance, __pyx_n_s_exp); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 83, __pyx_L1_error)
  18858. __Pyx_GOTREF(__pyx_tuple__28);
  18859. __Pyx_GIVEREF(__pyx_tuple__28);
  18860. __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 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_app_trade_trade_utils_pyx, __pyx_n_s_trade_distance, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 83, __pyx_L1_error)
  18861. /* "View.MemoryView":286
  18862. * return self.name
  18863. *
  18864. * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
  18865. * cdef strided = Enum("<strided and direct>") # default
  18866. * cdef indirect = Enum("<strided and indirect>")
  18867. */
  18868. __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(2, 286, __pyx_L1_error)
  18869. __Pyx_GOTREF(__pyx_tuple__30);
  18870. __Pyx_GIVEREF(__pyx_tuple__30);
  18871. /* "View.MemoryView":287
  18872. *
  18873. * cdef generic = Enum("<strided and direct or indirect>")
  18874. * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
  18875. * cdef indirect = Enum("<strided and indirect>")
  18876. *
  18877. */
  18878. __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(2, 287, __pyx_L1_error)
  18879. __Pyx_GOTREF(__pyx_tuple__31);
  18880. __Pyx_GIVEREF(__pyx_tuple__31);
  18881. /* "View.MemoryView":288
  18882. * cdef generic = Enum("<strided and direct or indirect>")
  18883. * cdef strided = Enum("<strided and direct>") # default
  18884. * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
  18885. *
  18886. *
  18887. */
  18888. __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(2, 288, __pyx_L1_error)
  18889. __Pyx_GOTREF(__pyx_tuple__32);
  18890. __Pyx_GIVEREF(__pyx_tuple__32);
  18891. /* "View.MemoryView":291
  18892. *
  18893. *
  18894. * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
  18895. * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  18896. *
  18897. */
  18898. __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(2, 291, __pyx_L1_error)
  18899. __Pyx_GOTREF(__pyx_tuple__33);
  18900. __Pyx_GIVEREF(__pyx_tuple__33);
  18901. /* "View.MemoryView":292
  18902. *
  18903. * cdef contiguous = Enum("<contiguous and direct>")
  18904. * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
  18905. *
  18906. *
  18907. */
  18908. __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(2, 292, __pyx_L1_error)
  18909. __Pyx_GOTREF(__pyx_tuple__34);
  18910. __Pyx_GIVEREF(__pyx_tuple__34);
  18911. /* "(tree fragment)":1
  18912. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  18913. * cdef object __pyx_PickleError
  18914. * cdef object __pyx_result
  18915. */
  18916. __pyx_tuple__35 = 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__35)) __PYX_ERR(2, 1, __pyx_L1_error)
  18917. __Pyx_GOTREF(__pyx_tuple__35);
  18918. __Pyx_GIVEREF(__pyx_tuple__35);
  18919. __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(2, 1, __pyx_L1_error)
  18920. __Pyx_RefNannyFinishContext();
  18921. return 0;
  18922. __pyx_L1_error:;
  18923. __Pyx_RefNannyFinishContext();
  18924. return -1;
  18925. }
  18926. static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  18927. if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  18928. __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
  18929. __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  18930. __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
  18931. __pyx_int_6 = PyInt_FromLong(6); if (unlikely(!__pyx_int_6)) __PYX_ERR(0, 1, __pyx_L1_error)
  18932. __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
  18933. __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  18934. return 0;
  18935. __pyx_L1_error:;
  18936. return -1;
  18937. }
  18938. static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
  18939. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
  18940. static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
  18941. static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
  18942. static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
  18943. static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
  18944. static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
  18945. static int __Pyx_modinit_global_init_code(void) {
  18946. __Pyx_RefNannyDeclarations
  18947. __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
  18948. /*--- Global init code ---*/
  18949. generic = Py_None; Py_INCREF(Py_None);
  18950. strided = Py_None; Py_INCREF(Py_None);
  18951. indirect = Py_None; Py_INCREF(Py_None);
  18952. contiguous = Py_None; Py_INCREF(Py_None);
  18953. indirect_contiguous = Py_None; Py_INCREF(Py_None);
  18954. __Pyx_RefNannyFinishContext();
  18955. return 0;
  18956. }
  18957. static int __Pyx_modinit_variable_export_code(void) {
  18958. __Pyx_RefNannyDeclarations
  18959. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
  18960. /*--- Variable export code ---*/
  18961. __Pyx_RefNannyFinishContext();
  18962. return 0;
  18963. }
  18964. static int __Pyx_modinit_function_export_code(void) {
  18965. __Pyx_RefNannyDeclarations
  18966. __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
  18967. /*--- Function export code ---*/
  18968. __Pyx_RefNannyFinishContext();
  18969. return 0;
  18970. }
  18971. static int __Pyx_modinit_type_init_code(void) {
  18972. __Pyx_RefNannyDeclarations
  18973. __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
  18974. /*--- Type init code ---*/
  18975. __pyx_vtabptr_array = &__pyx_vtable_array;
  18976. __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;
  18977. if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
  18978. #if PY_VERSION_HEX < 0x030800B1
  18979. __pyx_type___pyx_array.tp_print = 0;
  18980. #endif
  18981. if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
  18982. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 105, __pyx_L1_error)
  18983. __pyx_array_type = &__pyx_type___pyx_array;
  18984. if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
  18985. #if PY_VERSION_HEX < 0x030800B1
  18986. __pyx_type___pyx_MemviewEnum.tp_print = 0;
  18987. #endif
  18988. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
  18989. __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  18990. }
  18991. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 279, __pyx_L1_error)
  18992. __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
  18993. __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
  18994. __pyx_vtable_memoryview.get_item_pointer = (char *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
  18995. __pyx_vtable_memoryview.is_slice = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
  18996. __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
  18997. __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(struct __pyx_memoryview_obj *, struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
  18998. __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
  18999. __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryview_convert_item_to_object;
  19000. __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryview_assign_item_from_object;
  19001. if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
  19002. #if PY_VERSION_HEX < 0x030800B1
  19003. __pyx_type___pyx_memoryview.tp_print = 0;
  19004. #endif
  19005. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
  19006. __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  19007. }
  19008. if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
  19009. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 330, __pyx_L1_error)
  19010. __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
  19011. __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
  19012. __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
  19013. __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *))__pyx_memoryviewslice_convert_item_to_object;
  19014. __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(struct __pyx_memoryview_obj *, char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
  19015. __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
  19016. if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
  19017. #if PY_VERSION_HEX < 0x030800B1
  19018. __pyx_type___pyx_memoryviewslice.tp_print = 0;
  19019. #endif
  19020. if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
  19021. __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
  19022. }
  19023. if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
  19024. if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 965, __pyx_L1_error)
  19025. __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
  19026. __Pyx_RefNannyFinishContext();
  19027. return 0;
  19028. __pyx_L1_error:;
  19029. __Pyx_RefNannyFinishContext();
  19030. return -1;
  19031. }
  19032. static int __Pyx_modinit_type_import_code(void) {
  19033. __Pyx_RefNannyDeclarations
  19034. PyObject *__pyx_t_1 = NULL;
  19035. __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
  19036. /*--- Type import code ---*/
  19037. __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
  19038. __Pyx_GOTREF(__pyx_t_1);
  19039. __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
  19040. #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
  19041. sizeof(PyTypeObject),
  19042. #else
  19043. sizeof(PyHeapTypeObject),
  19044. #endif
  19045. __Pyx_ImportType_CheckSize_Warn);
  19046. if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
  19047. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19048. __pyx_t_1 = PyImport_ImportModule("numpy"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 206, __pyx_L1_error)
  19049. __Pyx_GOTREF(__pyx_t_1);
  19050. __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1, "numpy", "dtype", sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
  19051. if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(1, 206, __pyx_L1_error)
  19052. __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1, "numpy", "flatiter", sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Warn);
  19053. if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(1, 229, __pyx_L1_error)
  19054. __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1, "numpy", "broadcast", sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Warn);
  19055. if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(1, 233, __pyx_L1_error)
  19056. __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1, "numpy", "ndarray", sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
  19057. if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(1, 242, __pyx_L1_error)
  19058. __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1, "numpy", "ufunc", sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Warn);
  19059. if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(1, 918, __pyx_L1_error)
  19060. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19061. __Pyx_RefNannyFinishContext();
  19062. return 0;
  19063. __pyx_L1_error:;
  19064. __Pyx_XDECREF(__pyx_t_1);
  19065. __Pyx_RefNannyFinishContext();
  19066. return -1;
  19067. }
  19068. static int __Pyx_modinit_variable_import_code(void) {
  19069. __Pyx_RefNannyDeclarations
  19070. __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
  19071. /*--- Variable import code ---*/
  19072. __Pyx_RefNannyFinishContext();
  19073. return 0;
  19074. }
  19075. static int __Pyx_modinit_function_import_code(void) {
  19076. __Pyx_RefNannyDeclarations
  19077. __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
  19078. /*--- Function import code ---*/
  19079. __Pyx_RefNannyFinishContext();
  19080. return 0;
  19081. }
  19082. #if PY_MAJOR_VERSION < 3
  19083. #ifdef CYTHON_NO_PYINIT_EXPORT
  19084. #define __Pyx_PyMODINIT_FUNC void
  19085. #else
  19086. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  19087. #endif
  19088. #else
  19089. #ifdef CYTHON_NO_PYINIT_EXPORT
  19090. #define __Pyx_PyMODINIT_FUNC PyObject *
  19091. #else
  19092. #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
  19093. #endif
  19094. #endif
  19095. #if PY_MAJOR_VERSION < 3
  19096. __Pyx_PyMODINIT_FUNC inittrade_utils(void) CYTHON_SMALL_CODE; /*proto*/
  19097. __Pyx_PyMODINIT_FUNC inittrade_utils(void)
  19098. #else
  19099. __Pyx_PyMODINIT_FUNC PyInit_trade_utils(void) CYTHON_SMALL_CODE; /*proto*/
  19100. __Pyx_PyMODINIT_FUNC PyInit_trade_utils(void)
  19101. #if CYTHON_PEP489_MULTI_PHASE_INIT
  19102. {
  19103. return PyModuleDef_Init(&__pyx_moduledef);
  19104. }
  19105. static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  19106. #if PY_VERSION_HEX >= 0x030700A1
  19107. static PY_INT64_T main_interpreter_id = -1;
  19108. PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
  19109. if (main_interpreter_id == -1) {
  19110. main_interpreter_id = current_id;
  19111. return (unlikely(current_id == -1)) ? -1 : 0;
  19112. } else if (unlikely(main_interpreter_id != current_id))
  19113. #else
  19114. static PyInterpreterState *main_interpreter = NULL;
  19115. PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
  19116. if (!main_interpreter) {
  19117. main_interpreter = current_interpreter;
  19118. } else if (unlikely(main_interpreter != current_interpreter))
  19119. #endif
  19120. {
  19121. PyErr_SetString(
  19122. PyExc_ImportError,
  19123. "Interpreter change detected - this module can only be loaded into one interpreter per process.");
  19124. return -1;
  19125. }
  19126. return 0;
  19127. }
  19128. 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) {
  19129. PyObject *value = PyObject_GetAttrString(spec, from_name);
  19130. int result = 0;
  19131. if (likely(value)) {
  19132. if (allow_none || value != Py_None) {
  19133. result = PyDict_SetItemString(moddict, to_name, value);
  19134. }
  19135. Py_DECREF(value);
  19136. } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
  19137. PyErr_Clear();
  19138. } else {
  19139. result = -1;
  19140. }
  19141. return result;
  19142. }
  19143. static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
  19144. PyObject *module = NULL, *moddict, *modname;
  19145. if (__Pyx_check_single_interpreter())
  19146. return NULL;
  19147. if (__pyx_m)
  19148. return __Pyx_NewRef(__pyx_m);
  19149. modname = PyObject_GetAttrString(spec, "name");
  19150. if (unlikely(!modname)) goto bad;
  19151. module = PyModule_NewObject(modname);
  19152. Py_DECREF(modname);
  19153. if (unlikely(!module)) goto bad;
  19154. moddict = PyModule_GetDict(module);
  19155. if (unlikely(!moddict)) goto bad;
  19156. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
  19157. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
  19158. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
  19159. if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
  19160. return module;
  19161. bad:
  19162. Py_XDECREF(module);
  19163. return NULL;
  19164. }
  19165. static CYTHON_SMALL_CODE int __pyx_pymod_exec_trade_utils(PyObject *__pyx_pyinit_module)
  19166. #endif
  19167. #endif
  19168. {
  19169. PyObject *__pyx_t_1 = NULL;
  19170. static PyThread_type_lock __pyx_t_2[8];
  19171. __Pyx_RefNannyDeclarations
  19172. #if CYTHON_PEP489_MULTI_PHASE_INIT
  19173. if (__pyx_m) {
  19174. if (__pyx_m == __pyx_pyinit_module) return 0;
  19175. PyErr_SetString(PyExc_RuntimeError, "Module 'trade_utils' has already been imported. Re-initialisation is not supported.");
  19176. return -1;
  19177. }
  19178. #elif PY_MAJOR_VERSION >= 3
  19179. if (__pyx_m) return __Pyx_NewRef(__pyx_m);
  19180. #endif
  19181. #if CYTHON_REFNANNY
  19182. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  19183. if (!__Pyx_RefNanny) {
  19184. PyErr_Clear();
  19185. __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
  19186. if (!__Pyx_RefNanny)
  19187. Py_FatalError("failed to import 'refnanny' module");
  19188. }
  19189. #endif
  19190. __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_trade_utils(void)", 0);
  19191. if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19192. #ifdef __Pxy_PyFrame_Initialize_Offsets
  19193. __Pxy_PyFrame_Initialize_Offsets();
  19194. #endif
  19195. __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
  19196. __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
  19197. __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
  19198. #ifdef __Pyx_CyFunction_USED
  19199. if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19200. #endif
  19201. #ifdef __Pyx_FusedFunction_USED
  19202. if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19203. #endif
  19204. #ifdef __Pyx_Coroutine_USED
  19205. if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19206. #endif
  19207. #ifdef __Pyx_Generator_USED
  19208. if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19209. #endif
  19210. #ifdef __Pyx_AsyncGen_USED
  19211. if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19212. #endif
  19213. #ifdef __Pyx_StopAsyncIteration_USED
  19214. if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19215. #endif
  19216. /*--- Library function declarations ---*/
  19217. /*--- Threads initialization code ---*/
  19218. #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  19219. #ifdef WITH_THREAD /* Python build with threading support? */
  19220. PyEval_InitThreads();
  19221. #endif
  19222. #endif
  19223. /*--- Module creation code ---*/
  19224. #if CYTHON_PEP489_MULTI_PHASE_INIT
  19225. __pyx_m = __pyx_pyinit_module;
  19226. Py_INCREF(__pyx_m);
  19227. #else
  19228. #if PY_MAJOR_VERSION < 3
  19229. __pyx_m = Py_InitModule4("trade_utils", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  19230. #else
  19231. __pyx_m = PyModule_Create(&__pyx_moduledef);
  19232. #endif
  19233. if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
  19234. #endif
  19235. __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
  19236. Py_INCREF(__pyx_d);
  19237. __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
  19238. Py_INCREF(__pyx_b);
  19239. __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
  19240. Py_INCREF(__pyx_cython_runtime);
  19241. if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
  19242. /*--- Initialize various global constants etc. ---*/
  19243. if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19244. #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  19245. if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19246. #endif
  19247. if (__pyx_module_is_main_app__trade__trade_utils) {
  19248. if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19249. }
  19250. #if PY_MAJOR_VERSION >= 3
  19251. {
  19252. PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
  19253. if (!PyDict_GetItemString(modules, "app.trade.trade_utils")) {
  19254. if (unlikely(PyDict_SetItemString(modules, "app.trade.trade_utils", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
  19255. }
  19256. }
  19257. #endif
  19258. /*--- Builtin init code ---*/
  19259. if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error;
  19260. /*--- Constants init code ---*/
  19261. if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error;
  19262. /*--- Global type/function init code ---*/
  19263. (void)__Pyx_modinit_global_init_code();
  19264. (void)__Pyx_modinit_variable_export_code();
  19265. (void)__Pyx_modinit_function_export_code();
  19266. if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error;
  19267. if (unlikely(__Pyx_modinit_type_import_code() != 0)) goto __pyx_L1_error;
  19268. (void)__Pyx_modinit_variable_import_code();
  19269. (void)__Pyx_modinit_function_import_code();
  19270. /*--- Execution code ---*/
  19271. #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
  19272. if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19273. #endif
  19274. /* "app/trade/trade_utils.pyx":3
  19275. * # distutils: language=c++
  19276. * cimport cython
  19277. * import numpy as np # <<<<<<<<<<<<<<
  19278. * cimport numpy as np
  19279. *
  19280. */
  19281. __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error)
  19282. __Pyx_GOTREF(__pyx_t_1);
  19283. if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error)
  19284. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19285. /* "app/trade/trade_utils.pyx":83
  19286. *
  19287. *
  19288. * def trade_distance(int i, int j, float trade_range, trade_traversal_cost: np.ndarray, trade_value: np.ndarray): # <<<<<<<<<<<<<<
  19289. * distance = np.full_like(trade_traversal_cost, -1)
  19290. * exp = _trade_distance(i, j, trade_range, trade_traversal_cost, trade_value, distance)
  19291. */
  19292. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_3app_5trade_11trade_utils_1trade_distance, NULL, __pyx_n_s_app_trade_trade_utils); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
  19293. __Pyx_GOTREF(__pyx_t_1);
  19294. if (PyDict_SetItem(__pyx_d, __pyx_n_s_trade_distance, __pyx_t_1) < 0) __PYX_ERR(0, 83, __pyx_L1_error)
  19295. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19296. /* "app/trade/trade_utils.pyx":1
  19297. * # distutils: language=c++ # <<<<<<<<<<<<<<
  19298. * cimport cython
  19299. * import numpy as np
  19300. */
  19301. __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
  19302. __Pyx_GOTREF(__pyx_t_1);
  19303. if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
  19304. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19305. /* "View.MemoryView":209
  19306. * info.obj = self
  19307. *
  19308. * __pyx_getbuffer = capsule(<void *> &__pyx_array_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  19309. *
  19310. * def __dealloc__(array self):
  19311. */
  19312. __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_array_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 209, __pyx_L1_error)
  19313. __Pyx_GOTREF(__pyx_t_1);
  19314. if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 209, __pyx_L1_error)
  19315. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19316. PyType_Modified(__pyx_array_type);
  19317. /* "View.MemoryView":286
  19318. * return self.name
  19319. *
  19320. * cdef generic = Enum("<strided and direct or indirect>") # <<<<<<<<<<<<<<
  19321. * cdef strided = Enum("<strided and direct>") # default
  19322. * cdef indirect = Enum("<strided and indirect>")
  19323. */
  19324. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 286, __pyx_L1_error)
  19325. __Pyx_GOTREF(__pyx_t_1);
  19326. __Pyx_XGOTREF(generic);
  19327. __Pyx_DECREF_SET(generic, __pyx_t_1);
  19328. __Pyx_GIVEREF(__pyx_t_1);
  19329. __pyx_t_1 = 0;
  19330. /* "View.MemoryView":287
  19331. *
  19332. * cdef generic = Enum("<strided and direct or indirect>")
  19333. * cdef strided = Enum("<strided and direct>") # default # <<<<<<<<<<<<<<
  19334. * cdef indirect = Enum("<strided and indirect>")
  19335. *
  19336. */
  19337. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
  19338. __Pyx_GOTREF(__pyx_t_1);
  19339. __Pyx_XGOTREF(strided);
  19340. __Pyx_DECREF_SET(strided, __pyx_t_1);
  19341. __Pyx_GIVEREF(__pyx_t_1);
  19342. __pyx_t_1 = 0;
  19343. /* "View.MemoryView":288
  19344. * cdef generic = Enum("<strided and direct or indirect>")
  19345. * cdef strided = Enum("<strided and direct>") # default
  19346. * cdef indirect = Enum("<strided and indirect>") # <<<<<<<<<<<<<<
  19347. *
  19348. *
  19349. */
  19350. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
  19351. __Pyx_GOTREF(__pyx_t_1);
  19352. __Pyx_XGOTREF(indirect);
  19353. __Pyx_DECREF_SET(indirect, __pyx_t_1);
  19354. __Pyx_GIVEREF(__pyx_t_1);
  19355. __pyx_t_1 = 0;
  19356. /* "View.MemoryView":291
  19357. *
  19358. *
  19359. * cdef contiguous = Enum("<contiguous and direct>") # <<<<<<<<<<<<<<
  19360. * cdef indirect_contiguous = Enum("<contiguous and indirect>")
  19361. *
  19362. */
  19363. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 291, __pyx_L1_error)
  19364. __Pyx_GOTREF(__pyx_t_1);
  19365. __Pyx_XGOTREF(contiguous);
  19366. __Pyx_DECREF_SET(contiguous, __pyx_t_1);
  19367. __Pyx_GIVEREF(__pyx_t_1);
  19368. __pyx_t_1 = 0;
  19369. /* "View.MemoryView":292
  19370. *
  19371. * cdef contiguous = Enum("<contiguous and direct>")
  19372. * cdef indirect_contiguous = Enum("<contiguous and indirect>") # <<<<<<<<<<<<<<
  19373. *
  19374. *
  19375. */
  19376. __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
  19377. __Pyx_GOTREF(__pyx_t_1);
  19378. __Pyx_XGOTREF(indirect_contiguous);
  19379. __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
  19380. __Pyx_GIVEREF(__pyx_t_1);
  19381. __pyx_t_1 = 0;
  19382. /* "View.MemoryView":316
  19383. *
  19384. * DEF THREAD_LOCKS_PREALLOCATED = 8
  19385. * cdef int __pyx_memoryview_thread_locks_used = 0 # <<<<<<<<<<<<<<
  19386. * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [
  19387. * PyThread_allocate_lock(),
  19388. */
  19389. __pyx_memoryview_thread_locks_used = 0;
  19390. /* "View.MemoryView":317
  19391. * DEF THREAD_LOCKS_PREALLOCATED = 8
  19392. * cdef int __pyx_memoryview_thread_locks_used = 0
  19393. * cdef PyThread_type_lock[THREAD_LOCKS_PREALLOCATED] __pyx_memoryview_thread_locks = [ # <<<<<<<<<<<<<<
  19394. * PyThread_allocate_lock(),
  19395. * PyThread_allocate_lock(),
  19396. */
  19397. __pyx_t_2[0] = PyThread_allocate_lock();
  19398. __pyx_t_2[1] = PyThread_allocate_lock();
  19399. __pyx_t_2[2] = PyThread_allocate_lock();
  19400. __pyx_t_2[3] = PyThread_allocate_lock();
  19401. __pyx_t_2[4] = PyThread_allocate_lock();
  19402. __pyx_t_2[5] = PyThread_allocate_lock();
  19403. __pyx_t_2[6] = PyThread_allocate_lock();
  19404. __pyx_t_2[7] = PyThread_allocate_lock();
  19405. memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2, sizeof(__pyx_memoryview_thread_locks[0]) * (8));
  19406. /* "View.MemoryView":549
  19407. * info.obj = self
  19408. *
  19409. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  19410. *
  19411. *
  19412. */
  19413. __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 549, __pyx_L1_error)
  19414. __Pyx_GOTREF(__pyx_t_1);
  19415. if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 549, __pyx_L1_error)
  19416. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19417. PyType_Modified(__pyx_memoryview_type);
  19418. /* "View.MemoryView":995
  19419. * return self.from_object
  19420. *
  19421. * __pyx_getbuffer = capsule(<void *> &__pyx_memoryview_getbuffer, "getbuffer(obj, view, flags)") # <<<<<<<<<<<<<<
  19422. *
  19423. *
  19424. */
  19425. __pyx_t_1 = __pyx_capsule_create(((void *)(&__pyx_memoryview_getbuffer)), ((char *)"getbuffer(obj, view, flags)")); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 995, __pyx_L1_error)
  19426. __Pyx_GOTREF(__pyx_t_1);
  19427. if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 995, __pyx_L1_error)
  19428. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19429. PyType_Modified(__pyx_memoryviewslice_type);
  19430. /* "(tree fragment)":1
  19431. * def __pyx_unpickle_Enum(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<<
  19432. * cdef object __pyx_PickleError
  19433. * cdef object __pyx_result
  19434. */
  19435. __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
  19436. __Pyx_GOTREF(__pyx_t_1);
  19437. if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
  19438. __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  19439. /* "(tree fragment)":11
  19440. * __pyx_unpickle_Enum__set_state(<Enum> __pyx_result, __pyx_state)
  19441. * return __pyx_result
  19442. * cdef __pyx_unpickle_Enum__set_state(Enum __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<<
  19443. * __pyx_result.name = __pyx_state[0]
  19444. * if len(__pyx_state) > 1 and hasattr(__pyx_result, '__dict__'):
  19445. */
  19446. /*--- Wrapped vars code ---*/
  19447. goto __pyx_L0;
  19448. __pyx_L1_error:;
  19449. __Pyx_XDECREF(__pyx_t_1);
  19450. if (__pyx_m) {
  19451. if (__pyx_d) {
  19452. __Pyx_AddTraceback("init app.trade.trade_utils", __pyx_clineno, __pyx_lineno, __pyx_filename);
  19453. }
  19454. Py_CLEAR(__pyx_m);
  19455. } else if (!PyErr_Occurred()) {
  19456. PyErr_SetString(PyExc_ImportError, "init app.trade.trade_utils");
  19457. }
  19458. __pyx_L0:;
  19459. __Pyx_RefNannyFinishContext();
  19460. #if CYTHON_PEP489_MULTI_PHASE_INIT
  19461. return (__pyx_m != NULL) ? 0 : -1;
  19462. #elif PY_MAJOR_VERSION >= 3
  19463. return __pyx_m;
  19464. #else
  19465. return;
  19466. #endif
  19467. }
  19468. /* --- Runtime support code --- */
  19469. /* Refnanny */
  19470. #if CYTHON_REFNANNY
  19471. static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
  19472. PyObject *m = NULL, *p = NULL;
  19473. void *r = NULL;
  19474. m = PyImport_ImportModule(modname);
  19475. if (!m) goto end;
  19476. p = PyObject_GetAttrString(m, "RefNannyAPI");
  19477. if (!p) goto end;
  19478. r = PyLong_AsVoidPtr(p);
  19479. end:
  19480. Py_XDECREF(p);
  19481. Py_XDECREF(m);
  19482. return (__Pyx_RefNannyAPIStruct *)r;
  19483. }
  19484. #endif
  19485. /* PyObjectGetAttrStr */
  19486. #if CYTHON_USE_TYPE_SLOTS
  19487. static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  19488. PyTypeObject* tp = Py_TYPE(obj);
  19489. if (likely(tp->tp_getattro))
  19490. return tp->tp_getattro(obj, attr_name);
  19491. #if PY_MAJOR_VERSION < 3
  19492. if (likely(tp->tp_getattr))
  19493. return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  19494. #endif
  19495. return PyObject_GetAttr(obj, attr_name);
  19496. }
  19497. #endif
  19498. /* GetBuiltinName */
  19499. static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  19500. PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
  19501. if (unlikely(!result)) {
  19502. PyErr_Format(PyExc_NameError,
  19503. #if PY_MAJOR_VERSION >= 3
  19504. "name '%U' is not defined", name);
  19505. #else
  19506. "name '%.200s' is not defined", PyString_AS_STRING(name));
  19507. #endif
  19508. }
  19509. return result;
  19510. }
  19511. /* None */
  19512. static CYTHON_INLINE long __Pyx_mod_long(long a, long b) {
  19513. long r = a % b;
  19514. r += ((r != 0) & ((r ^ b) < 0)) * b;
  19515. return r;
  19516. }
  19517. /* PyDictVersioning */
  19518. #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
  19519. static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  19520. PyObject *dict = Py_TYPE(obj)->tp_dict;
  19521. return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
  19522. }
  19523. static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
  19524. PyObject **dictptr = NULL;
  19525. Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
  19526. if (offset) {
  19527. #if CYTHON_COMPILING_IN_CPYTHON
  19528. dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
  19529. #else
  19530. dictptr = _PyObject_GetDictPtr(obj);
  19531. #endif
  19532. }
  19533. return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
  19534. }
  19535. static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
  19536. PyObject *dict = Py_TYPE(obj)->tp_dict;
  19537. if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
  19538. return 0;
  19539. return obj_dict_version == __Pyx_get_object_dict_version(obj);
  19540. }
  19541. #endif
  19542. /* GetModuleGlobalName */
  19543. #if CYTHON_USE_DICT_VERSIONS
  19544. static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
  19545. #else
  19546. static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  19547. #endif
  19548. {
  19549. PyObject *result;
  19550. #if !CYTHON_AVOID_BORROWED_REFS
  19551. #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
  19552. result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
  19553. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  19554. if (likely(result)) {
  19555. return __Pyx_NewRef(result);
  19556. } else if (unlikely(PyErr_Occurred())) {
  19557. return NULL;
  19558. }
  19559. #else
  19560. result = PyDict_GetItem(__pyx_d, name);
  19561. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  19562. if (likely(result)) {
  19563. return __Pyx_NewRef(result);
  19564. }
  19565. #endif
  19566. #else
  19567. result = PyObject_GetItem(__pyx_d, name);
  19568. __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
  19569. if (likely(result)) {
  19570. return __Pyx_NewRef(result);
  19571. }
  19572. PyErr_Clear();
  19573. #endif
  19574. return __Pyx_GetBuiltinName(name);
  19575. }
  19576. /* PyObjectCall */
  19577. #if CYTHON_COMPILING_IN_CPYTHON
  19578. static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
  19579. PyObject *result;
  19580. ternaryfunc call = func->ob_type->tp_call;
  19581. if (unlikely(!call))
  19582. return PyObject_Call(func, arg, kw);
  19583. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  19584. return NULL;
  19585. result = (*call)(func, arg, kw);
  19586. Py_LeaveRecursiveCall();
  19587. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  19588. PyErr_SetString(
  19589. PyExc_SystemError,
  19590. "NULL result without error in PyObject_Call");
  19591. }
  19592. return result;
  19593. }
  19594. #endif
  19595. /* BufferIndexError */
  19596. static void __Pyx_RaiseBufferIndexError(int axis) {
  19597. PyErr_Format(PyExc_IndexError,
  19598. "Out of bounds on buffer access (axis %d)", axis);
  19599. }
  19600. /* MemviewSliceInit */
  19601. static int
  19602. __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview,
  19603. int ndim,
  19604. __Pyx_memviewslice *memviewslice,
  19605. int memview_is_new_reference)
  19606. {
  19607. __Pyx_RefNannyDeclarations
  19608. int i, retval=-1;
  19609. Py_buffer *buf = &memview->view;
  19610. __Pyx_RefNannySetupContext("init_memviewslice", 0);
  19611. if (memviewslice->memview || memviewslice->data) {
  19612. PyErr_SetString(PyExc_ValueError,
  19613. "memviewslice is already initialized!");
  19614. goto fail;
  19615. }
  19616. if (buf->strides) {
  19617. for (i = 0; i < ndim; i++) {
  19618. memviewslice->strides[i] = buf->strides[i];
  19619. }
  19620. } else {
  19621. Py_ssize_t stride = buf->itemsize;
  19622. for (i = ndim - 1; i >= 0; i--) {
  19623. memviewslice->strides[i] = stride;
  19624. stride *= buf->shape[i];
  19625. }
  19626. }
  19627. for (i = 0; i < ndim; i++) {
  19628. memviewslice->shape[i] = buf->shape[i];
  19629. if (buf->suboffsets) {
  19630. memviewslice->suboffsets[i] = buf->suboffsets[i];
  19631. } else {
  19632. memviewslice->suboffsets[i] = -1;
  19633. }
  19634. }
  19635. memviewslice->memview = memview;
  19636. memviewslice->data = (char *)buf->buf;
  19637. if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
  19638. Py_INCREF(memview);
  19639. }
  19640. retval = 0;
  19641. goto no_fail;
  19642. fail:
  19643. memviewslice->memview = 0;
  19644. memviewslice->data = 0;
  19645. retval = -1;
  19646. no_fail:
  19647. __Pyx_RefNannyFinishContext();
  19648. return retval;
  19649. }
  19650. #ifndef Py_NO_RETURN
  19651. #define Py_NO_RETURN
  19652. #endif
  19653. static void __pyx_fatalerror(const char *fmt, ...) Py_NO_RETURN {
  19654. va_list vargs;
  19655. char msg[200];
  19656. #ifdef HAVE_STDARG_PROTOTYPES
  19657. va_start(vargs, fmt);
  19658. #else
  19659. va_start(vargs);
  19660. #endif
  19661. vsnprintf(msg, 200, fmt, vargs);
  19662. va_end(vargs);
  19663. Py_FatalError(msg);
  19664. }
  19665. static CYTHON_INLINE int
  19666. __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
  19667. PyThread_type_lock lock)
  19668. {
  19669. int result;
  19670. PyThread_acquire_lock(lock, 1);
  19671. result = (*acquisition_count)++;
  19672. PyThread_release_lock(lock);
  19673. return result;
  19674. }
  19675. static CYTHON_INLINE int
  19676. __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
  19677. PyThread_type_lock lock)
  19678. {
  19679. int result;
  19680. PyThread_acquire_lock(lock, 1);
  19681. result = (*acquisition_count)--;
  19682. PyThread_release_lock(lock);
  19683. return result;
  19684. }
  19685. static CYTHON_INLINE void
  19686. __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno)
  19687. {
  19688. int first_time;
  19689. struct __pyx_memoryview_obj *memview = memslice->memview;
  19690. if (!memview || (PyObject *) memview == Py_None)
  19691. return;
  19692. if (__pyx_get_slice_count(memview) < 0)
  19693. __pyx_fatalerror("Acquisition count is %d (line %d)",
  19694. __pyx_get_slice_count(memview), lineno);
  19695. first_time = __pyx_add_acquisition_count(memview) == 0;
  19696. if (first_time) {
  19697. if (have_gil) {
  19698. Py_INCREF((PyObject *) memview);
  19699. } else {
  19700. PyGILState_STATE _gilstate = PyGILState_Ensure();
  19701. Py_INCREF((PyObject *) memview);
  19702. PyGILState_Release(_gilstate);
  19703. }
  19704. }
  19705. }
  19706. static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
  19707. int have_gil, int lineno) {
  19708. int last_time;
  19709. struct __pyx_memoryview_obj *memview = memslice->memview;
  19710. if (!memview ) {
  19711. return;
  19712. } else if ((PyObject *) memview == Py_None) {
  19713. memslice->memview = NULL;
  19714. return;
  19715. }
  19716. if (__pyx_get_slice_count(memview) <= 0)
  19717. __pyx_fatalerror("Acquisition count is %d (line %d)",
  19718. __pyx_get_slice_count(memview), lineno);
  19719. last_time = __pyx_sub_acquisition_count(memview) == 1;
  19720. memslice->data = NULL;
  19721. if (last_time) {
  19722. if (have_gil) {
  19723. Py_CLEAR(memslice->memview);
  19724. } else {
  19725. PyGILState_STATE _gilstate = PyGILState_Ensure();
  19726. Py_CLEAR(memslice->memview);
  19727. PyGILState_Release(_gilstate);
  19728. }
  19729. } else {
  19730. memslice->memview = NULL;
  19731. }
  19732. }
  19733. /* RaiseArgTupleInvalid */
  19734. static void __Pyx_RaiseArgtupleInvalid(
  19735. const char* func_name,
  19736. int exact,
  19737. Py_ssize_t num_min,
  19738. Py_ssize_t num_max,
  19739. Py_ssize_t num_found)
  19740. {
  19741. Py_ssize_t num_expected;
  19742. const char *more_or_less;
  19743. if (num_found < num_min) {
  19744. num_expected = num_min;
  19745. more_or_less = "at least";
  19746. } else {
  19747. num_expected = num_max;
  19748. more_or_less = "at most";
  19749. }
  19750. if (exact) {
  19751. more_or_less = "exactly";
  19752. }
  19753. PyErr_Format(PyExc_TypeError,
  19754. "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
  19755. func_name, more_or_less, num_expected,
  19756. (num_expected == 1) ? "" : "s", num_found);
  19757. }
  19758. /* RaiseDoubleKeywords */
  19759. static void __Pyx_RaiseDoubleKeywordsError(
  19760. const char* func_name,
  19761. PyObject* kw_name)
  19762. {
  19763. PyErr_Format(PyExc_TypeError,
  19764. #if PY_MAJOR_VERSION >= 3
  19765. "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
  19766. #else
  19767. "%s() got multiple values for keyword argument '%s'", func_name,
  19768. PyString_AsString(kw_name));
  19769. #endif
  19770. }
  19771. /* ParseKeywords */
  19772. static int __Pyx_ParseOptionalKeywords(
  19773. PyObject *kwds,
  19774. PyObject **argnames[],
  19775. PyObject *kwds2,
  19776. PyObject *values[],
  19777. Py_ssize_t num_pos_args,
  19778. const char* function_name)
  19779. {
  19780. PyObject *key = 0, *value = 0;
  19781. Py_ssize_t pos = 0;
  19782. PyObject*** name;
  19783. PyObject*** first_kw_arg = argnames + num_pos_args;
  19784. while (PyDict_Next(kwds, &pos, &key, &value)) {
  19785. name = first_kw_arg;
  19786. while (*name && (**name != key)) name++;
  19787. if (*name) {
  19788. values[name-argnames] = value;
  19789. continue;
  19790. }
  19791. name = first_kw_arg;
  19792. #if PY_MAJOR_VERSION < 3
  19793. if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
  19794. while (*name) {
  19795. if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
  19796. && _PyString_Eq(**name, key)) {
  19797. values[name-argnames] = value;
  19798. break;
  19799. }
  19800. name++;
  19801. }
  19802. if (*name) continue;
  19803. else {
  19804. PyObject*** argname = argnames;
  19805. while (argname != first_kw_arg) {
  19806. if ((**argname == key) || (
  19807. (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
  19808. && _PyString_Eq(**argname, key))) {
  19809. goto arg_passed_twice;
  19810. }
  19811. argname++;
  19812. }
  19813. }
  19814. } else
  19815. #endif
  19816. if (likely(PyUnicode_Check(key))) {
  19817. while (*name) {
  19818. int cmp = (**name == key) ? 0 :
  19819. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  19820. (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
  19821. #endif
  19822. PyUnicode_Compare(**name, key);
  19823. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  19824. if (cmp == 0) {
  19825. values[name-argnames] = value;
  19826. break;
  19827. }
  19828. name++;
  19829. }
  19830. if (*name) continue;
  19831. else {
  19832. PyObject*** argname = argnames;
  19833. while (argname != first_kw_arg) {
  19834. int cmp = (**argname == key) ? 0 :
  19835. #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
  19836. (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
  19837. #endif
  19838. PyUnicode_Compare(**argname, key);
  19839. if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
  19840. if (cmp == 0) goto arg_passed_twice;
  19841. argname++;
  19842. }
  19843. }
  19844. } else
  19845. goto invalid_keyword_type;
  19846. if (kwds2) {
  19847. if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
  19848. } else {
  19849. goto invalid_keyword;
  19850. }
  19851. }
  19852. return 0;
  19853. arg_passed_twice:
  19854. __Pyx_RaiseDoubleKeywordsError(function_name, key);
  19855. goto bad;
  19856. invalid_keyword_type:
  19857. PyErr_Format(PyExc_TypeError,
  19858. "%.200s() keywords must be strings", function_name);
  19859. goto bad;
  19860. invalid_keyword:
  19861. PyErr_Format(PyExc_TypeError,
  19862. #if PY_MAJOR_VERSION < 3
  19863. "%.200s() got an unexpected keyword argument '%.200s'",
  19864. function_name, PyString_AsString(key));
  19865. #else
  19866. "%s() got an unexpected keyword argument '%U'",
  19867. function_name, key);
  19868. #endif
  19869. bad:
  19870. return -1;
  19871. }
  19872. /* ArgTypeTest */
  19873. static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact)
  19874. {
  19875. if (unlikely(!type)) {
  19876. PyErr_SetString(PyExc_SystemError, "Missing type object");
  19877. return 0;
  19878. }
  19879. else if (exact) {
  19880. #if PY_MAJOR_VERSION == 2
  19881. if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
  19882. #endif
  19883. }
  19884. else {
  19885. if (likely(__Pyx_TypeCheck(obj, type))) return 1;
  19886. }
  19887. PyErr_Format(PyExc_TypeError,
  19888. "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
  19889. name, type->tp_name, Py_TYPE(obj)->tp_name);
  19890. return 0;
  19891. }
  19892. /* PyFunctionFastCall */
  19893. #if CYTHON_FAST_PYCALL
  19894. static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
  19895. PyObject *globals) {
  19896. PyFrameObject *f;
  19897. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  19898. PyObject **fastlocals;
  19899. Py_ssize_t i;
  19900. PyObject *result;
  19901. assert(globals != NULL);
  19902. /* XXX Perhaps we should create a specialized
  19903. PyFrame_New() that doesn't take locals, but does
  19904. take builtins without sanity checking them.
  19905. */
  19906. assert(tstate != NULL);
  19907. f = PyFrame_New(tstate, co, globals, NULL);
  19908. if (f == NULL) {
  19909. return NULL;
  19910. }
  19911. fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
  19912. for (i = 0; i < na; i++) {
  19913. Py_INCREF(*args);
  19914. fastlocals[i] = *args++;
  19915. }
  19916. result = PyEval_EvalFrameEx(f,0);
  19917. ++tstate->recursion_depth;
  19918. Py_DECREF(f);
  19919. --tstate->recursion_depth;
  19920. return result;
  19921. }
  19922. #if 1 || PY_VERSION_HEX < 0x030600B1
  19923. static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
  19924. PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
  19925. PyObject *globals = PyFunction_GET_GLOBALS(func);
  19926. PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
  19927. PyObject *closure;
  19928. #if PY_MAJOR_VERSION >= 3
  19929. PyObject *kwdefs;
  19930. #endif
  19931. PyObject *kwtuple, **k;
  19932. PyObject **d;
  19933. Py_ssize_t nd;
  19934. Py_ssize_t nk;
  19935. PyObject *result;
  19936. assert(kwargs == NULL || PyDict_Check(kwargs));
  19937. nk = kwargs ? PyDict_Size(kwargs) : 0;
  19938. if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
  19939. return NULL;
  19940. }
  19941. if (
  19942. #if PY_MAJOR_VERSION >= 3
  19943. co->co_kwonlyargcount == 0 &&
  19944. #endif
  19945. likely(kwargs == NULL || nk == 0) &&
  19946. co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
  19947. if (argdefs == NULL && co->co_argcount == nargs) {
  19948. result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
  19949. goto done;
  19950. }
  19951. else if (nargs == 0 && argdefs != NULL
  19952. && co->co_argcount == Py_SIZE(argdefs)) {
  19953. /* function called with no arguments, but all parameters have
  19954. a default value: use default values as arguments .*/
  19955. args = &PyTuple_GET_ITEM(argdefs, 0);
  19956. result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
  19957. goto done;
  19958. }
  19959. }
  19960. if (kwargs != NULL) {
  19961. Py_ssize_t pos, i;
  19962. kwtuple = PyTuple_New(2 * nk);
  19963. if (kwtuple == NULL) {
  19964. result = NULL;
  19965. goto done;
  19966. }
  19967. k = &PyTuple_GET_ITEM(kwtuple, 0);
  19968. pos = i = 0;
  19969. while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
  19970. Py_INCREF(k[i]);
  19971. Py_INCREF(k[i+1]);
  19972. i += 2;
  19973. }
  19974. nk = i / 2;
  19975. }
  19976. else {
  19977. kwtuple = NULL;
  19978. k = NULL;
  19979. }
  19980. closure = PyFunction_GET_CLOSURE(func);
  19981. #if PY_MAJOR_VERSION >= 3
  19982. kwdefs = PyFunction_GET_KW_DEFAULTS(func);
  19983. #endif
  19984. if (argdefs != NULL) {
  19985. d = &PyTuple_GET_ITEM(argdefs, 0);
  19986. nd = Py_SIZE(argdefs);
  19987. }
  19988. else {
  19989. d = NULL;
  19990. nd = 0;
  19991. }
  19992. #if PY_MAJOR_VERSION >= 3
  19993. result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
  19994. args, (int)nargs,
  19995. k, (int)nk,
  19996. d, (int)nd, kwdefs, closure);
  19997. #else
  19998. result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
  19999. args, (int)nargs,
  20000. k, (int)nk,
  20001. d, (int)nd, closure);
  20002. #endif
  20003. Py_XDECREF(kwtuple);
  20004. done:
  20005. Py_LeaveRecursiveCall();
  20006. return result;
  20007. }
  20008. #endif
  20009. #endif
  20010. /* PyCFunctionFastCall */
  20011. #if CYTHON_FAST_PYCCALL
  20012. static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
  20013. PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
  20014. PyCFunction meth = PyCFunction_GET_FUNCTION(func);
  20015. PyObject *self = PyCFunction_GET_SELF(func);
  20016. int flags = PyCFunction_GET_FLAGS(func);
  20017. assert(PyCFunction_Check(func));
  20018. assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
  20019. assert(nargs >= 0);
  20020. assert(nargs == 0 || args != NULL);
  20021. /* _PyCFunction_FastCallDict() must not be called with an exception set,
  20022. because it may clear it (directly or indirectly) and so the
  20023. caller loses its exception */
  20024. assert(!PyErr_Occurred());
  20025. if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
  20026. return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
  20027. } else {
  20028. return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
  20029. }
  20030. }
  20031. #endif
  20032. /* GetItemInt */
  20033. static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  20034. PyObject *r;
  20035. if (!j) return NULL;
  20036. r = PyObject_GetItem(o, j);
  20037. Py_DECREF(j);
  20038. return r;
  20039. }
  20040. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
  20041. CYTHON_NCP_UNUSED int wraparound,
  20042. CYTHON_NCP_UNUSED int boundscheck) {
  20043. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  20044. Py_ssize_t wrapped_i = i;
  20045. if (wraparound & unlikely(i < 0)) {
  20046. wrapped_i += PyList_GET_SIZE(o);
  20047. }
  20048. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
  20049. PyObject *r = PyList_GET_ITEM(o, wrapped_i);
  20050. Py_INCREF(r);
  20051. return r;
  20052. }
  20053. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  20054. #else
  20055. return PySequence_GetItem(o, i);
  20056. #endif
  20057. }
  20058. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
  20059. CYTHON_NCP_UNUSED int wraparound,
  20060. CYTHON_NCP_UNUSED int boundscheck) {
  20061. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
  20062. Py_ssize_t wrapped_i = i;
  20063. if (wraparound & unlikely(i < 0)) {
  20064. wrapped_i += PyTuple_GET_SIZE(o);
  20065. }
  20066. if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
  20067. PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
  20068. Py_INCREF(r);
  20069. return r;
  20070. }
  20071. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  20072. #else
  20073. return PySequence_GetItem(o, i);
  20074. #endif
  20075. }
  20076. static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
  20077. CYTHON_NCP_UNUSED int wraparound,
  20078. CYTHON_NCP_UNUSED int boundscheck) {
  20079. #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
  20080. if (is_list || PyList_CheckExact(o)) {
  20081. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
  20082. if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
  20083. PyObject *r = PyList_GET_ITEM(o, n);
  20084. Py_INCREF(r);
  20085. return r;
  20086. }
  20087. }
  20088. else if (PyTuple_CheckExact(o)) {
  20089. Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
  20090. if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
  20091. PyObject *r = PyTuple_GET_ITEM(o, n);
  20092. Py_INCREF(r);
  20093. return r;
  20094. }
  20095. } else {
  20096. PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
  20097. if (likely(m && m->sq_item)) {
  20098. if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
  20099. Py_ssize_t l = m->sq_length(o);
  20100. if (likely(l >= 0)) {
  20101. i += l;
  20102. } else {
  20103. if (!PyErr_ExceptionMatches(PyExc_OverflowError))
  20104. return NULL;
  20105. PyErr_Clear();
  20106. }
  20107. }
  20108. return m->sq_item(o, i);
  20109. }
  20110. }
  20111. #else
  20112. if (is_list || PySequence_Check(o)) {
  20113. return PySequence_GetItem(o, i);
  20114. }
  20115. #endif
  20116. return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
  20117. }
  20118. /* ObjectGetItem */
  20119. #if CYTHON_USE_TYPE_SLOTS
  20120. static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
  20121. PyObject *runerr;
  20122. Py_ssize_t key_value;
  20123. PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
  20124. if (unlikely(!(m && m->sq_item))) {
  20125. PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
  20126. return NULL;
  20127. }
  20128. key_value = __Pyx_PyIndex_AsSsize_t(index);
  20129. if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
  20130. return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
  20131. }
  20132. if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
  20133. PyErr_Clear();
  20134. PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
  20135. }
  20136. return NULL;
  20137. }
  20138. static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
  20139. PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
  20140. if (likely(m && m->mp_subscript)) {
  20141. return m->mp_subscript(obj, key);
  20142. }
  20143. return __Pyx_PyObject_GetIndex(obj, key);
  20144. }
  20145. #endif
  20146. /* RaiseTooManyValuesToUnpack */
  20147. static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
  20148. PyErr_Format(PyExc_ValueError,
  20149. "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
  20150. }
  20151. /* RaiseNeedMoreValuesToUnpack */
  20152. static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
  20153. PyErr_Format(PyExc_ValueError,
  20154. "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
  20155. index, (index == 1) ? "" : "s");
  20156. }
  20157. /* IterFinish */
  20158. static CYTHON_INLINE int __Pyx_IterFinish(void) {
  20159. #if CYTHON_FAST_THREAD_STATE
  20160. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  20161. PyObject* exc_type = tstate->curexc_type;
  20162. if (unlikely(exc_type)) {
  20163. if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
  20164. PyObject *exc_value, *exc_tb;
  20165. exc_value = tstate->curexc_value;
  20166. exc_tb = tstate->curexc_traceback;
  20167. tstate->curexc_type = 0;
  20168. tstate->curexc_value = 0;
  20169. tstate->curexc_traceback = 0;
  20170. Py_DECREF(exc_type);
  20171. Py_XDECREF(exc_value);
  20172. Py_XDECREF(exc_tb);
  20173. return 0;
  20174. } else {
  20175. return -1;
  20176. }
  20177. }
  20178. return 0;
  20179. #else
  20180. if (unlikely(PyErr_Occurred())) {
  20181. if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
  20182. PyErr_Clear();
  20183. return 0;
  20184. } else {
  20185. return -1;
  20186. }
  20187. }
  20188. return 0;
  20189. #endif
  20190. }
  20191. /* UnpackItemEndCheck */
  20192. static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
  20193. if (unlikely(retval)) {
  20194. Py_DECREF(retval);
  20195. __Pyx_RaiseTooManyValuesError(expected);
  20196. return -1;
  20197. } else {
  20198. return __Pyx_IterFinish();
  20199. }
  20200. return 0;
  20201. }
  20202. /* PyErrFetchRestore */
  20203. #if CYTHON_FAST_THREAD_STATE
  20204. static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  20205. PyObject *tmp_type, *tmp_value, *tmp_tb;
  20206. tmp_type = tstate->curexc_type;
  20207. tmp_value = tstate->curexc_value;
  20208. tmp_tb = tstate->curexc_traceback;
  20209. tstate->curexc_type = type;
  20210. tstate->curexc_value = value;
  20211. tstate->curexc_traceback = tb;
  20212. Py_XDECREF(tmp_type);
  20213. Py_XDECREF(tmp_value);
  20214. Py_XDECREF(tmp_tb);
  20215. }
  20216. static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  20217. *type = tstate->curexc_type;
  20218. *value = tstate->curexc_value;
  20219. *tb = tstate->curexc_traceback;
  20220. tstate->curexc_type = 0;
  20221. tstate->curexc_value = 0;
  20222. tstate->curexc_traceback = 0;
  20223. }
  20224. #endif
  20225. /* RaiseException */
  20226. #if PY_MAJOR_VERSION < 3
  20227. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  20228. CYTHON_UNUSED PyObject *cause) {
  20229. __Pyx_PyThreadState_declare
  20230. Py_XINCREF(type);
  20231. if (!value || value == Py_None)
  20232. value = NULL;
  20233. else
  20234. Py_INCREF(value);
  20235. if (!tb || tb == Py_None)
  20236. tb = NULL;
  20237. else {
  20238. Py_INCREF(tb);
  20239. if (!PyTraceBack_Check(tb)) {
  20240. PyErr_SetString(PyExc_TypeError,
  20241. "raise: arg 3 must be a traceback or None");
  20242. goto raise_error;
  20243. }
  20244. }
  20245. if (PyType_Check(type)) {
  20246. #if CYTHON_COMPILING_IN_PYPY
  20247. if (!value) {
  20248. Py_INCREF(Py_None);
  20249. value = Py_None;
  20250. }
  20251. #endif
  20252. PyErr_NormalizeException(&type, &value, &tb);
  20253. } else {
  20254. if (value) {
  20255. PyErr_SetString(PyExc_TypeError,
  20256. "instance exception may not have a separate value");
  20257. goto raise_error;
  20258. }
  20259. value = type;
  20260. type = (PyObject*) Py_TYPE(type);
  20261. Py_INCREF(type);
  20262. if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
  20263. PyErr_SetString(PyExc_TypeError,
  20264. "raise: exception class must be a subclass of BaseException");
  20265. goto raise_error;
  20266. }
  20267. }
  20268. __Pyx_PyThreadState_assign
  20269. __Pyx_ErrRestore(type, value, tb);
  20270. return;
  20271. raise_error:
  20272. Py_XDECREF(value);
  20273. Py_XDECREF(type);
  20274. Py_XDECREF(tb);
  20275. return;
  20276. }
  20277. #else
  20278. static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
  20279. PyObject* owned_instance = NULL;
  20280. if (tb == Py_None) {
  20281. tb = 0;
  20282. } else if (tb && !PyTraceBack_Check(tb)) {
  20283. PyErr_SetString(PyExc_TypeError,
  20284. "raise: arg 3 must be a traceback or None");
  20285. goto bad;
  20286. }
  20287. if (value == Py_None)
  20288. value = 0;
  20289. if (PyExceptionInstance_Check(type)) {
  20290. if (value) {
  20291. PyErr_SetString(PyExc_TypeError,
  20292. "instance exception may not have a separate value");
  20293. goto bad;
  20294. }
  20295. value = type;
  20296. type = (PyObject*) Py_TYPE(value);
  20297. } else if (PyExceptionClass_Check(type)) {
  20298. PyObject *instance_class = NULL;
  20299. if (value && PyExceptionInstance_Check(value)) {
  20300. instance_class = (PyObject*) Py_TYPE(value);
  20301. if (instance_class != type) {
  20302. int is_subclass = PyObject_IsSubclass(instance_class, type);
  20303. if (!is_subclass) {
  20304. instance_class = NULL;
  20305. } else if (unlikely(is_subclass == -1)) {
  20306. goto bad;
  20307. } else {
  20308. type = instance_class;
  20309. }
  20310. }
  20311. }
  20312. if (!instance_class) {
  20313. PyObject *args;
  20314. if (!value)
  20315. args = PyTuple_New(0);
  20316. else if (PyTuple_Check(value)) {
  20317. Py_INCREF(value);
  20318. args = value;
  20319. } else
  20320. args = PyTuple_Pack(1, value);
  20321. if (!args)
  20322. goto bad;
  20323. owned_instance = PyObject_Call(type, args, NULL);
  20324. Py_DECREF(args);
  20325. if (!owned_instance)
  20326. goto bad;
  20327. value = owned_instance;
  20328. if (!PyExceptionInstance_Check(value)) {
  20329. PyErr_Format(PyExc_TypeError,
  20330. "calling %R should have returned an instance of "
  20331. "BaseException, not %R",
  20332. type, Py_TYPE(value));
  20333. goto bad;
  20334. }
  20335. }
  20336. } else {
  20337. PyErr_SetString(PyExc_TypeError,
  20338. "raise: exception class must be a subclass of BaseException");
  20339. goto bad;
  20340. }
  20341. if (cause) {
  20342. PyObject *fixed_cause;
  20343. if (cause == Py_None) {
  20344. fixed_cause = NULL;
  20345. } else if (PyExceptionClass_Check(cause)) {
  20346. fixed_cause = PyObject_CallObject(cause, NULL);
  20347. if (fixed_cause == NULL)
  20348. goto bad;
  20349. } else if (PyExceptionInstance_Check(cause)) {
  20350. fixed_cause = cause;
  20351. Py_INCREF(fixed_cause);
  20352. } else {
  20353. PyErr_SetString(PyExc_TypeError,
  20354. "exception causes must derive from "
  20355. "BaseException");
  20356. goto bad;
  20357. }
  20358. PyException_SetCause(value, fixed_cause);
  20359. }
  20360. PyErr_SetObject(type, value);
  20361. if (tb) {
  20362. #if CYTHON_COMPILING_IN_PYPY
  20363. PyObject *tmp_type, *tmp_value, *tmp_tb;
  20364. PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
  20365. Py_INCREF(tb);
  20366. PyErr_Restore(tmp_type, tmp_value, tb);
  20367. Py_XDECREF(tmp_tb);
  20368. #else
  20369. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  20370. PyObject* tmp_tb = tstate->curexc_traceback;
  20371. if (tb != tmp_tb) {
  20372. Py_INCREF(tb);
  20373. tstate->curexc_traceback = tb;
  20374. Py_XDECREF(tmp_tb);
  20375. }
  20376. #endif
  20377. }
  20378. bad:
  20379. Py_XDECREF(owned_instance);
  20380. return;
  20381. }
  20382. #endif
  20383. /* PyObjectCallMethO */
  20384. #if CYTHON_COMPILING_IN_CPYTHON
  20385. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
  20386. PyObject *self, *result;
  20387. PyCFunction cfunc;
  20388. cfunc = PyCFunction_GET_FUNCTION(func);
  20389. self = PyCFunction_GET_SELF(func);
  20390. if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
  20391. return NULL;
  20392. result = cfunc(self, arg);
  20393. Py_LeaveRecursiveCall();
  20394. if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
  20395. PyErr_SetString(
  20396. PyExc_SystemError,
  20397. "NULL result without error in PyObject_Call");
  20398. }
  20399. return result;
  20400. }
  20401. #endif
  20402. /* PyObjectCallOneArg */
  20403. #if CYTHON_COMPILING_IN_CPYTHON
  20404. static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  20405. PyObject *result;
  20406. PyObject *args = PyTuple_New(1);
  20407. if (unlikely(!args)) return NULL;
  20408. Py_INCREF(arg);
  20409. PyTuple_SET_ITEM(args, 0, arg);
  20410. result = __Pyx_PyObject_Call(func, args, NULL);
  20411. Py_DECREF(args);
  20412. return result;
  20413. }
  20414. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  20415. #if CYTHON_FAST_PYCALL
  20416. if (PyFunction_Check(func)) {
  20417. return __Pyx_PyFunction_FastCall(func, &arg, 1);
  20418. }
  20419. #endif
  20420. if (likely(PyCFunction_Check(func))) {
  20421. if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
  20422. return __Pyx_PyObject_CallMethO(func, arg);
  20423. #if CYTHON_FAST_PYCCALL
  20424. } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
  20425. return __Pyx_PyCFunction_FastCall(func, &arg, 1);
  20426. #endif
  20427. }
  20428. }
  20429. return __Pyx__PyObject_CallOneArg(func, arg);
  20430. }
  20431. #else
  20432. static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
  20433. PyObject *result;
  20434. PyObject *args = PyTuple_Pack(1, arg);
  20435. if (unlikely(!args)) return NULL;
  20436. result = __Pyx_PyObject_Call(func, args, NULL);
  20437. Py_DECREF(args);
  20438. return result;
  20439. }
  20440. #endif
  20441. /* DictGetItem */
  20442. #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
  20443. static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  20444. PyObject *value;
  20445. value = PyDict_GetItemWithError(d, key);
  20446. if (unlikely(!value)) {
  20447. if (!PyErr_Occurred()) {
  20448. if (unlikely(PyTuple_Check(key))) {
  20449. PyObject* args = PyTuple_Pack(1, key);
  20450. if (likely(args)) {
  20451. PyErr_SetObject(PyExc_KeyError, args);
  20452. Py_DECREF(args);
  20453. }
  20454. } else {
  20455. PyErr_SetObject(PyExc_KeyError, key);
  20456. }
  20457. }
  20458. return NULL;
  20459. }
  20460. Py_INCREF(value);
  20461. return value;
  20462. }
  20463. #endif
  20464. /* RaiseNoneIterError */
  20465. static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  20466. PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
  20467. }
  20468. /* ExtTypeTest */
  20469. static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
  20470. if (unlikely(!type)) {
  20471. PyErr_SetString(PyExc_SystemError, "Missing type object");
  20472. return 0;
  20473. }
  20474. if (likely(__Pyx_TypeCheck(obj, type)))
  20475. return 1;
  20476. PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
  20477. Py_TYPE(obj)->tp_name, type->tp_name);
  20478. return 0;
  20479. }
  20480. /* GetTopmostException */
  20481. #if CYTHON_USE_EXC_INFO_STACK
  20482. static _PyErr_StackItem *
  20483. __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
  20484. {
  20485. _PyErr_StackItem *exc_info = tstate->exc_info;
  20486. while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
  20487. exc_info->previous_item != NULL)
  20488. {
  20489. exc_info = exc_info->previous_item;
  20490. }
  20491. return exc_info;
  20492. }
  20493. #endif
  20494. /* SaveResetException */
  20495. #if CYTHON_FAST_THREAD_STATE
  20496. static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  20497. #if CYTHON_USE_EXC_INFO_STACK
  20498. _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
  20499. *type = exc_info->exc_type;
  20500. *value = exc_info->exc_value;
  20501. *tb = exc_info->exc_traceback;
  20502. #else
  20503. *type = tstate->exc_type;
  20504. *value = tstate->exc_value;
  20505. *tb = tstate->exc_traceback;
  20506. #endif
  20507. Py_XINCREF(*type);
  20508. Py_XINCREF(*value);
  20509. Py_XINCREF(*tb);
  20510. }
  20511. static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
  20512. PyObject *tmp_type, *tmp_value, *tmp_tb;
  20513. #if CYTHON_USE_EXC_INFO_STACK
  20514. _PyErr_StackItem *exc_info = tstate->exc_info;
  20515. tmp_type = exc_info->exc_type;
  20516. tmp_value = exc_info->exc_value;
  20517. tmp_tb = exc_info->exc_traceback;
  20518. exc_info->exc_type = type;
  20519. exc_info->exc_value = value;
  20520. exc_info->exc_traceback = tb;
  20521. #else
  20522. tmp_type = tstate->exc_type;
  20523. tmp_value = tstate->exc_value;
  20524. tmp_tb = tstate->exc_traceback;
  20525. tstate->exc_type = type;
  20526. tstate->exc_value = value;
  20527. tstate->exc_traceback = tb;
  20528. #endif
  20529. Py_XDECREF(tmp_type);
  20530. Py_XDECREF(tmp_value);
  20531. Py_XDECREF(tmp_tb);
  20532. }
  20533. #endif
  20534. /* PyErrExceptionMatches */
  20535. #if CYTHON_FAST_THREAD_STATE
  20536. static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  20537. Py_ssize_t i, n;
  20538. n = PyTuple_GET_SIZE(tuple);
  20539. #if PY_MAJOR_VERSION >= 3
  20540. for (i=0; i<n; i++) {
  20541. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  20542. }
  20543. #endif
  20544. for (i=0; i<n; i++) {
  20545. if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
  20546. }
  20547. return 0;
  20548. }
  20549. static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
  20550. PyObject *exc_type = tstate->curexc_type;
  20551. if (exc_type == err) return 1;
  20552. if (unlikely(!exc_type)) return 0;
  20553. if (unlikely(PyTuple_Check(err)))
  20554. return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
  20555. return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
  20556. }
  20557. #endif
  20558. /* GetException */
  20559. #if CYTHON_FAST_THREAD_STATE
  20560. static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
  20561. #else
  20562. static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
  20563. #endif
  20564. {
  20565. PyObject *local_type, *local_value, *local_tb;
  20566. #if CYTHON_FAST_THREAD_STATE
  20567. PyObject *tmp_type, *tmp_value, *tmp_tb;
  20568. local_type = tstate->curexc_type;
  20569. local_value = tstate->curexc_value;
  20570. local_tb = tstate->curexc_traceback;
  20571. tstate->curexc_type = 0;
  20572. tstate->curexc_value = 0;
  20573. tstate->curexc_traceback = 0;
  20574. #else
  20575. PyErr_Fetch(&local_type, &local_value, &local_tb);
  20576. #endif
  20577. PyErr_NormalizeException(&local_type, &local_value, &local_tb);
  20578. #if CYTHON_FAST_THREAD_STATE
  20579. if (unlikely(tstate->curexc_type))
  20580. #else
  20581. if (unlikely(PyErr_Occurred()))
  20582. #endif
  20583. goto bad;
  20584. #if PY_MAJOR_VERSION >= 3
  20585. if (local_tb) {
  20586. if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
  20587. goto bad;
  20588. }
  20589. #endif
  20590. Py_XINCREF(local_tb);
  20591. Py_XINCREF(local_type);
  20592. Py_XINCREF(local_value);
  20593. *type = local_type;
  20594. *value = local_value;
  20595. *tb = local_tb;
  20596. #if CYTHON_FAST_THREAD_STATE
  20597. #if CYTHON_USE_EXC_INFO_STACK
  20598. {
  20599. _PyErr_StackItem *exc_info = tstate->exc_info;
  20600. tmp_type = exc_info->exc_type;
  20601. tmp_value = exc_info->exc_value;
  20602. tmp_tb = exc_info->exc_traceback;
  20603. exc_info->exc_type = local_type;
  20604. exc_info->exc_value = local_value;
  20605. exc_info->exc_traceback = local_tb;
  20606. }
  20607. #else
  20608. tmp_type = tstate->exc_type;
  20609. tmp_value = tstate->exc_value;
  20610. tmp_tb = tstate->exc_traceback;
  20611. tstate->exc_type = local_type;
  20612. tstate->exc_value = local_value;
  20613. tstate->exc_traceback = local_tb;
  20614. #endif
  20615. Py_XDECREF(tmp_type);
  20616. Py_XDECREF(tmp_value);
  20617. Py_XDECREF(tmp_tb);
  20618. #else
  20619. PyErr_SetExcInfo(local_type, local_value, local_tb);
  20620. #endif
  20621. return 0;
  20622. bad:
  20623. *type = 0;
  20624. *value = 0;
  20625. *tb = 0;
  20626. Py_XDECREF(local_type);
  20627. Py_XDECREF(local_value);
  20628. Py_XDECREF(local_tb);
  20629. return -1;
  20630. }
  20631. /* PyObjectCall2Args */
  20632. static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
  20633. PyObject *args, *result = NULL;
  20634. #if CYTHON_FAST_PYCALL
  20635. if (PyFunction_Check(function)) {
  20636. PyObject *args[2] = {arg1, arg2};
  20637. return __Pyx_PyFunction_FastCall(function, args, 2);
  20638. }
  20639. #endif
  20640. #if CYTHON_FAST_PYCCALL
  20641. if (__Pyx_PyFastCFunction_Check(function)) {
  20642. PyObject *args[2] = {arg1, arg2};
  20643. return __Pyx_PyCFunction_FastCall(function, args, 2);
  20644. }
  20645. #endif
  20646. args = PyTuple_New(2);
  20647. if (unlikely(!args)) goto done;
  20648. Py_INCREF(arg1);
  20649. PyTuple_SET_ITEM(args, 0, arg1);
  20650. Py_INCREF(arg2);
  20651. PyTuple_SET_ITEM(args, 1, arg2);
  20652. Py_INCREF(function);
  20653. result = __Pyx_PyObject_Call(function, args, NULL);
  20654. Py_DECREF(args);
  20655. Py_DECREF(function);
  20656. done:
  20657. return result;
  20658. }
  20659. /* BytesEquals */
  20660. static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
  20661. #if CYTHON_COMPILING_IN_PYPY
  20662. return PyObject_RichCompareBool(s1, s2, equals);
  20663. #else
  20664. if (s1 == s2) {
  20665. return (equals == Py_EQ);
  20666. } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
  20667. const char *ps1, *ps2;
  20668. Py_ssize_t length = PyBytes_GET_SIZE(s1);
  20669. if (length != PyBytes_GET_SIZE(s2))
  20670. return (equals == Py_NE);
  20671. ps1 = PyBytes_AS_STRING(s1);
  20672. ps2 = PyBytes_AS_STRING(s2);
  20673. if (ps1[0] != ps2[0]) {
  20674. return (equals == Py_NE);
  20675. } else if (length == 1) {
  20676. return (equals == Py_EQ);
  20677. } else {
  20678. int result;
  20679. #if CYTHON_USE_UNICODE_INTERNALS
  20680. Py_hash_t hash1, hash2;
  20681. hash1 = ((PyBytesObject*)s1)->ob_shash;
  20682. hash2 = ((PyBytesObject*)s2)->ob_shash;
  20683. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  20684. return (equals == Py_NE);
  20685. }
  20686. #endif
  20687. result = memcmp(ps1, ps2, (size_t)length);
  20688. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  20689. }
  20690. } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
  20691. return (equals == Py_NE);
  20692. } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
  20693. return (equals == Py_NE);
  20694. } else {
  20695. int result;
  20696. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  20697. if (!py_result)
  20698. return -1;
  20699. result = __Pyx_PyObject_IsTrue(py_result);
  20700. Py_DECREF(py_result);
  20701. return result;
  20702. }
  20703. #endif
  20704. }
  20705. /* UnicodeEquals */
  20706. static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
  20707. #if CYTHON_COMPILING_IN_PYPY
  20708. return PyObject_RichCompareBool(s1, s2, equals);
  20709. #else
  20710. #if PY_MAJOR_VERSION < 3
  20711. PyObject* owned_ref = NULL;
  20712. #endif
  20713. int s1_is_unicode, s2_is_unicode;
  20714. if (s1 == s2) {
  20715. goto return_eq;
  20716. }
  20717. s1_is_unicode = PyUnicode_CheckExact(s1);
  20718. s2_is_unicode = PyUnicode_CheckExact(s2);
  20719. #if PY_MAJOR_VERSION < 3
  20720. if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
  20721. owned_ref = PyUnicode_FromObject(s2);
  20722. if (unlikely(!owned_ref))
  20723. return -1;
  20724. s2 = owned_ref;
  20725. s2_is_unicode = 1;
  20726. } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
  20727. owned_ref = PyUnicode_FromObject(s1);
  20728. if (unlikely(!owned_ref))
  20729. return -1;
  20730. s1 = owned_ref;
  20731. s1_is_unicode = 1;
  20732. } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
  20733. return __Pyx_PyBytes_Equals(s1, s2, equals);
  20734. }
  20735. #endif
  20736. if (s1_is_unicode & s2_is_unicode) {
  20737. Py_ssize_t length;
  20738. int kind;
  20739. void *data1, *data2;
  20740. if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
  20741. return -1;
  20742. length = __Pyx_PyUnicode_GET_LENGTH(s1);
  20743. if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
  20744. goto return_ne;
  20745. }
  20746. #if CYTHON_USE_UNICODE_INTERNALS
  20747. {
  20748. Py_hash_t hash1, hash2;
  20749. #if CYTHON_PEP393_ENABLED
  20750. hash1 = ((PyASCIIObject*)s1)->hash;
  20751. hash2 = ((PyASCIIObject*)s2)->hash;
  20752. #else
  20753. hash1 = ((PyUnicodeObject*)s1)->hash;
  20754. hash2 = ((PyUnicodeObject*)s2)->hash;
  20755. #endif
  20756. if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
  20757. goto return_ne;
  20758. }
  20759. }
  20760. #endif
  20761. kind = __Pyx_PyUnicode_KIND(s1);
  20762. if (kind != __Pyx_PyUnicode_KIND(s2)) {
  20763. goto return_ne;
  20764. }
  20765. data1 = __Pyx_PyUnicode_DATA(s1);
  20766. data2 = __Pyx_PyUnicode_DATA(s2);
  20767. if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
  20768. goto return_ne;
  20769. } else if (length == 1) {
  20770. goto return_eq;
  20771. } else {
  20772. int result = memcmp(data1, data2, (size_t)(length * kind));
  20773. #if PY_MAJOR_VERSION < 3
  20774. Py_XDECREF(owned_ref);
  20775. #endif
  20776. return (equals == Py_EQ) ? (result == 0) : (result != 0);
  20777. }
  20778. } else if ((s1 == Py_None) & s2_is_unicode) {
  20779. goto return_ne;
  20780. } else if ((s2 == Py_None) & s1_is_unicode) {
  20781. goto return_ne;
  20782. } else {
  20783. int result;
  20784. PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
  20785. #if PY_MAJOR_VERSION < 3
  20786. Py_XDECREF(owned_ref);
  20787. #endif
  20788. if (!py_result)
  20789. return -1;
  20790. result = __Pyx_PyObject_IsTrue(py_result);
  20791. Py_DECREF(py_result);
  20792. return result;
  20793. }
  20794. return_eq:
  20795. #if PY_MAJOR_VERSION < 3
  20796. Py_XDECREF(owned_ref);
  20797. #endif
  20798. return (equals == Py_EQ);
  20799. return_ne:
  20800. #if PY_MAJOR_VERSION < 3
  20801. Py_XDECREF(owned_ref);
  20802. #endif
  20803. return (equals == Py_NE);
  20804. #endif
  20805. }
  20806. /* None */
  20807. static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
  20808. Py_ssize_t q = a / b;
  20809. Py_ssize_t r = a - q*b;
  20810. q -= ((r != 0) & ((r ^ b) < 0));
  20811. return q;
  20812. }
  20813. /* GetAttr */
  20814. static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
  20815. #if CYTHON_USE_TYPE_SLOTS
  20816. #if PY_MAJOR_VERSION >= 3
  20817. if (likely(PyUnicode_Check(n)))
  20818. #else
  20819. if (likely(PyString_Check(n)))
  20820. #endif
  20821. return __Pyx_PyObject_GetAttrStr(o, n);
  20822. #endif
  20823. return PyObject_GetAttr(o, n);
  20824. }
  20825. /* decode_c_string */
  20826. static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
  20827. const char* cstring, Py_ssize_t start, Py_ssize_t stop,
  20828. const char* encoding, const char* errors,
  20829. PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
  20830. Py_ssize_t length;
  20831. if (unlikely((start < 0) | (stop < 0))) {
  20832. size_t slen = strlen(cstring);
  20833. if (unlikely(slen > (size_t) PY_SSIZE_T_MAX)) {
  20834. PyErr_SetString(PyExc_OverflowError,
  20835. "c-string too long to convert to Python");
  20836. return NULL;
  20837. }
  20838. length = (Py_ssize_t) slen;
  20839. if (start < 0) {
  20840. start += length;
  20841. if (start < 0)
  20842. start = 0;
  20843. }
  20844. if (stop < 0)
  20845. stop += length;
  20846. }
  20847. length = stop - start;
  20848. if (unlikely(length <= 0))
  20849. return PyUnicode_FromUnicode(NULL, 0);
  20850. cstring += start;
  20851. if (decode_func) {
  20852. return decode_func(cstring, length, errors);
  20853. } else {
  20854. return PyUnicode_Decode(cstring, length, encoding, errors);
  20855. }
  20856. }
  20857. /* GetAttr3 */
  20858. static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
  20859. __Pyx_PyThreadState_declare
  20860. __Pyx_PyThreadState_assign
  20861. if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
  20862. return NULL;
  20863. __Pyx_PyErr_Clear();
  20864. Py_INCREF(d);
  20865. return d;
  20866. }
  20867. static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
  20868. PyObject *r = __Pyx_GetAttr(o, n);
  20869. return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
  20870. }
  20871. /* SwapException */
  20872. #if CYTHON_FAST_THREAD_STATE
  20873. static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
  20874. PyObject *tmp_type, *tmp_value, *tmp_tb;
  20875. #if CYTHON_USE_EXC_INFO_STACK
  20876. _PyErr_StackItem *exc_info = tstate->exc_info;
  20877. tmp_type = exc_info->exc_type;
  20878. tmp_value = exc_info->exc_value;
  20879. tmp_tb = exc_info->exc_traceback;
  20880. exc_info->exc_type = *type;
  20881. exc_info->exc_value = *value;
  20882. exc_info->exc_traceback = *tb;
  20883. #else
  20884. tmp_type = tstate->exc_type;
  20885. tmp_value = tstate->exc_value;
  20886. tmp_tb = tstate->exc_traceback;
  20887. tstate->exc_type = *type;
  20888. tstate->exc_value = *value;
  20889. tstate->exc_traceback = *tb;
  20890. #endif
  20891. *type = tmp_type;
  20892. *value = tmp_value;
  20893. *tb = tmp_tb;
  20894. }
  20895. #else
  20896. static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
  20897. PyObject *tmp_type, *tmp_value, *tmp_tb;
  20898. PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
  20899. PyErr_SetExcInfo(*type, *value, *tb);
  20900. *type = tmp_type;
  20901. *value = tmp_value;
  20902. *tb = tmp_tb;
  20903. }
  20904. #endif
  20905. /* Import */
  20906. static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
  20907. PyObject *empty_list = 0;
  20908. PyObject *module = 0;
  20909. PyObject *global_dict = 0;
  20910. PyObject *empty_dict = 0;
  20911. PyObject *list;
  20912. #if PY_MAJOR_VERSION < 3
  20913. PyObject *py_import;
  20914. py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
  20915. if (!py_import)
  20916. goto bad;
  20917. #endif
  20918. if (from_list)
  20919. list = from_list;
  20920. else {
  20921. empty_list = PyList_New(0);
  20922. if (!empty_list)
  20923. goto bad;
  20924. list = empty_list;
  20925. }
  20926. global_dict = PyModule_GetDict(__pyx_m);
  20927. if (!global_dict)
  20928. goto bad;
  20929. empty_dict = PyDict_New();
  20930. if (!empty_dict)
  20931. goto bad;
  20932. {
  20933. #if PY_MAJOR_VERSION >= 3
  20934. if (level == -1) {
  20935. if (strchr(__Pyx_MODULE_NAME, '.')) {
  20936. module = PyImport_ImportModuleLevelObject(
  20937. name, global_dict, empty_dict, list, 1);
  20938. if (!module) {
  20939. if (!PyErr_ExceptionMatches(PyExc_ImportError))
  20940. goto bad;
  20941. PyErr_Clear();
  20942. }
  20943. }
  20944. level = 0;
  20945. }
  20946. #endif
  20947. if (!module) {
  20948. #if PY_MAJOR_VERSION < 3
  20949. PyObject *py_level = PyInt_FromLong(level);
  20950. if (!py_level)
  20951. goto bad;
  20952. module = PyObject_CallFunctionObjArgs(py_import,
  20953. name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
  20954. Py_DECREF(py_level);
  20955. #else
  20956. module = PyImport_ImportModuleLevelObject(
  20957. name, global_dict, empty_dict, list, level);
  20958. #endif
  20959. }
  20960. }
  20961. bad:
  20962. #if PY_MAJOR_VERSION < 3
  20963. Py_XDECREF(py_import);
  20964. #endif
  20965. Py_XDECREF(empty_list);
  20966. Py_XDECREF(empty_dict);
  20967. return module;
  20968. }
  20969. /* FastTypeChecks */
  20970. #if CYTHON_COMPILING_IN_CPYTHON
  20971. static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  20972. while (a) {
  20973. a = a->tp_base;
  20974. if (a == b)
  20975. return 1;
  20976. }
  20977. return b == &PyBaseObject_Type;
  20978. }
  20979. static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
  20980. PyObject *mro;
  20981. if (a == b) return 1;
  20982. mro = a->tp_mro;
  20983. if (likely(mro)) {
  20984. Py_ssize_t i, n;
  20985. n = PyTuple_GET_SIZE(mro);
  20986. for (i = 0; i < n; i++) {
  20987. if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
  20988. return 1;
  20989. }
  20990. return 0;
  20991. }
  20992. return __Pyx_InBases(a, b);
  20993. }
  20994. #if PY_MAJOR_VERSION == 2
  20995. static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
  20996. PyObject *exception, *value, *tb;
  20997. int res;
  20998. __Pyx_PyThreadState_declare
  20999. __Pyx_PyThreadState_assign
  21000. __Pyx_ErrFetch(&exception, &value, &tb);
  21001. res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
  21002. if (unlikely(res == -1)) {
  21003. PyErr_WriteUnraisable(err);
  21004. res = 0;
  21005. }
  21006. if (!res) {
  21007. res = PyObject_IsSubclass(err, exc_type2);
  21008. if (unlikely(res == -1)) {
  21009. PyErr_WriteUnraisable(err);
  21010. res = 0;
  21011. }
  21012. }
  21013. __Pyx_ErrRestore(exception, value, tb);
  21014. return res;
  21015. }
  21016. #else
  21017. static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
  21018. int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
  21019. if (!res) {
  21020. res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
  21021. }
  21022. return res;
  21023. }
  21024. #endif
  21025. static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
  21026. Py_ssize_t i, n;
  21027. assert(PyExceptionClass_Check(exc_type));
  21028. n = PyTuple_GET_SIZE(tuple);
  21029. #if PY_MAJOR_VERSION >= 3
  21030. for (i=0; i<n; i++) {
  21031. if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
  21032. }
  21033. #endif
  21034. for (i=0; i<n; i++) {
  21035. PyObject *t = PyTuple_GET_ITEM(tuple, i);
  21036. #if PY_MAJOR_VERSION < 3
  21037. if (likely(exc_type == t)) return 1;
  21038. #endif
  21039. if (likely(PyExceptionClass_Check(t))) {
  21040. if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
  21041. } else {
  21042. }
  21043. }
  21044. return 0;
  21045. }
  21046. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
  21047. if (likely(err == exc_type)) return 1;
  21048. if (likely(PyExceptionClass_Check(err))) {
  21049. if (likely(PyExceptionClass_Check(exc_type))) {
  21050. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
  21051. } else if (likely(PyTuple_Check(exc_type))) {
  21052. return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
  21053. } else {
  21054. }
  21055. }
  21056. return PyErr_GivenExceptionMatches(err, exc_type);
  21057. }
  21058. static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
  21059. assert(PyExceptionClass_Check(exc_type1));
  21060. assert(PyExceptionClass_Check(exc_type2));
  21061. if (likely(err == exc_type1 || err == exc_type2)) return 1;
  21062. if (likely(PyExceptionClass_Check(err))) {
  21063. return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
  21064. }
  21065. return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
  21066. }
  21067. #endif
  21068. /* PyIntBinop */
  21069. #if !CYTHON_COMPILING_IN_PYPY
  21070. static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) {
  21071. (void)inplace;
  21072. (void)zerodivision_check;
  21073. #if PY_MAJOR_VERSION < 3
  21074. if (likely(PyInt_CheckExact(op1))) {
  21075. const long b = intval;
  21076. long x;
  21077. long a = PyInt_AS_LONG(op1);
  21078. x = (long)((unsigned long)a + b);
  21079. if (likely((x^a) >= 0 || (x^b) >= 0))
  21080. return PyInt_FromLong(x);
  21081. return PyLong_Type.tp_as_number->nb_add(op1, op2);
  21082. }
  21083. #endif
  21084. #if CYTHON_USE_PYLONG_INTERNALS
  21085. if (likely(PyLong_CheckExact(op1))) {
  21086. const long b = intval;
  21087. long a, x;
  21088. #ifdef HAVE_LONG_LONG
  21089. const PY_LONG_LONG llb = intval;
  21090. PY_LONG_LONG lla, llx;
  21091. #endif
  21092. const digit* digits = ((PyLongObject*)op1)->ob_digit;
  21093. const Py_ssize_t size = Py_SIZE(op1);
  21094. if (likely(__Pyx_sst_abs(size) <= 1)) {
  21095. a = likely(size) ? digits[0] : 0;
  21096. if (size == -1) a = -a;
  21097. } else {
  21098. switch (size) {
  21099. case -2:
  21100. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  21101. a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  21102. break;
  21103. #ifdef HAVE_LONG_LONG
  21104. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  21105. lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  21106. goto long_long;
  21107. #endif
  21108. }
  21109. CYTHON_FALLTHROUGH;
  21110. case 2:
  21111. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  21112. a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  21113. break;
  21114. #ifdef HAVE_LONG_LONG
  21115. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
  21116. lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
  21117. goto long_long;
  21118. #endif
  21119. }
  21120. CYTHON_FALLTHROUGH;
  21121. case -3:
  21122. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  21123. a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  21124. break;
  21125. #ifdef HAVE_LONG_LONG
  21126. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  21127. 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]));
  21128. goto long_long;
  21129. #endif
  21130. }
  21131. CYTHON_FALLTHROUGH;
  21132. case 3:
  21133. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  21134. a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  21135. break;
  21136. #ifdef HAVE_LONG_LONG
  21137. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
  21138. 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]));
  21139. goto long_long;
  21140. #endif
  21141. }
  21142. CYTHON_FALLTHROUGH;
  21143. case -4:
  21144. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  21145. a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  21146. break;
  21147. #ifdef HAVE_LONG_LONG
  21148. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  21149. 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]));
  21150. goto long_long;
  21151. #endif
  21152. }
  21153. CYTHON_FALLTHROUGH;
  21154. case 4:
  21155. if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  21156. a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
  21157. break;
  21158. #ifdef HAVE_LONG_LONG
  21159. } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
  21160. 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]));
  21161. goto long_long;
  21162. #endif
  21163. }
  21164. CYTHON_FALLTHROUGH;
  21165. default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
  21166. }
  21167. }
  21168. x = a + b;
  21169. return PyLong_FromLong(x);
  21170. #ifdef HAVE_LONG_LONG
  21171. long_long:
  21172. llx = lla + llb;
  21173. return PyLong_FromLongLong(llx);
  21174. #endif
  21175. }
  21176. #endif
  21177. if (PyFloat_CheckExact(op1)) {
  21178. const long b = intval;
  21179. double a = PyFloat_AS_DOUBLE(op1);
  21180. double result;
  21181. PyFPE_START_PROTECT("add", return NULL)
  21182. result = ((double)a) + (double)b;
  21183. PyFPE_END_PROTECT(result)
  21184. return PyFloat_FromDouble(result);
  21185. }
  21186. return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
  21187. }
  21188. #endif
  21189. /* None */
  21190. static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
  21191. PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
  21192. }
  21193. /* None */
  21194. static CYTHON_INLINE long __Pyx_div_long(long a, long b) {
  21195. long q = a / b;
  21196. long r = a - q*b;
  21197. q -= ((r != 0) & ((r ^ b) < 0));
  21198. return q;
  21199. }
  21200. /* ImportFrom */
  21201. static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
  21202. PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
  21203. if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
  21204. PyErr_Format(PyExc_ImportError,
  21205. #if PY_MAJOR_VERSION < 3
  21206. "cannot import name %.230s", PyString_AS_STRING(name));
  21207. #else
  21208. "cannot import name %S", name);
  21209. #endif
  21210. }
  21211. return value;
  21212. }
  21213. /* HasAttr */
  21214. static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) {
  21215. PyObject *r;
  21216. if (unlikely(!__Pyx_PyBaseString_Check(n))) {
  21217. PyErr_SetString(PyExc_TypeError,
  21218. "hasattr(): attribute name must be string");
  21219. return -1;
  21220. }
  21221. r = __Pyx_GetAttr(o, n);
  21222. if (unlikely(!r)) {
  21223. PyErr_Clear();
  21224. return 0;
  21225. } else {
  21226. Py_DECREF(r);
  21227. return 1;
  21228. }
  21229. }
  21230. /* PyObject_GenericGetAttrNoDict */
  21231. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  21232. static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
  21233. PyErr_Format(PyExc_AttributeError,
  21234. #if PY_MAJOR_VERSION >= 3
  21235. "'%.50s' object has no attribute '%U'",
  21236. tp->tp_name, attr_name);
  21237. #else
  21238. "'%.50s' object has no attribute '%.400s'",
  21239. tp->tp_name, PyString_AS_STRING(attr_name));
  21240. #endif
  21241. return NULL;
  21242. }
  21243. static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
  21244. PyObject *descr;
  21245. PyTypeObject *tp = Py_TYPE(obj);
  21246. if (unlikely(!PyString_Check(attr_name))) {
  21247. return PyObject_GenericGetAttr(obj, attr_name);
  21248. }
  21249. assert(!tp->tp_dictoffset);
  21250. descr = _PyType_Lookup(tp, attr_name);
  21251. if (unlikely(!descr)) {
  21252. return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
  21253. }
  21254. Py_INCREF(descr);
  21255. #if PY_MAJOR_VERSION < 3
  21256. if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
  21257. #endif
  21258. {
  21259. descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
  21260. if (unlikely(f)) {
  21261. PyObject *res = f(descr, obj, (PyObject *)tp);
  21262. Py_DECREF(descr);
  21263. return res;
  21264. }
  21265. }
  21266. return descr;
  21267. }
  21268. #endif
  21269. /* PyObject_GenericGetAttr */
  21270. #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
  21271. static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
  21272. if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
  21273. return PyObject_GenericGetAttr(obj, attr_name);
  21274. }
  21275. return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
  21276. }
  21277. #endif
  21278. /* SetVTable */
  21279. static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
  21280. #if PY_VERSION_HEX >= 0x02070000
  21281. PyObject *ob = PyCapsule_New(vtable, 0, 0);
  21282. #else
  21283. PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
  21284. #endif
  21285. if (!ob)
  21286. goto bad;
  21287. if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
  21288. goto bad;
  21289. Py_DECREF(ob);
  21290. return 0;
  21291. bad:
  21292. Py_XDECREF(ob);
  21293. return -1;
  21294. }
  21295. /* SetupReduce */
  21296. static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  21297. int ret;
  21298. PyObject *name_attr;
  21299. name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
  21300. if (likely(name_attr)) {
  21301. ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
  21302. } else {
  21303. ret = -1;
  21304. }
  21305. if (unlikely(ret < 0)) {
  21306. PyErr_Clear();
  21307. ret = 0;
  21308. }
  21309. Py_XDECREF(name_attr);
  21310. return ret;
  21311. }
  21312. static int __Pyx_setup_reduce(PyObject* type_obj) {
  21313. int ret = 0;
  21314. PyObject *object_reduce = NULL;
  21315. PyObject *object_reduce_ex = NULL;
  21316. PyObject *reduce = NULL;
  21317. PyObject *reduce_ex = NULL;
  21318. PyObject *reduce_cython = NULL;
  21319. PyObject *setstate = NULL;
  21320. PyObject *setstate_cython = NULL;
  21321. #if CYTHON_USE_PYTYPE_LOOKUP
  21322. if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
  21323. #else
  21324. if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
  21325. #endif
  21326. #if CYTHON_USE_PYTYPE_LOOKUP
  21327. object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  21328. #else
  21329. object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
  21330. #endif
  21331. reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
  21332. if (reduce_ex == object_reduce_ex) {
  21333. #if CYTHON_USE_PYTYPE_LOOKUP
  21334. object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
  21335. #else
  21336. object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
  21337. #endif
  21338. reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
  21339. if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
  21340. reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto __PYX_BAD;
  21341. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  21342. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  21343. setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
  21344. if (!setstate) PyErr_Clear();
  21345. if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
  21346. setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto __PYX_BAD;
  21347. ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  21348. ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
  21349. }
  21350. PyType_Modified((PyTypeObject*)type_obj);
  21351. }
  21352. }
  21353. goto __PYX_GOOD;
  21354. __PYX_BAD:
  21355. if (!PyErr_Occurred())
  21356. PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
  21357. ret = -1;
  21358. __PYX_GOOD:
  21359. #if !CYTHON_USE_PYTYPE_LOOKUP
  21360. Py_XDECREF(object_reduce);
  21361. Py_XDECREF(object_reduce_ex);
  21362. #endif
  21363. Py_XDECREF(reduce);
  21364. Py_XDECREF(reduce_ex);
  21365. Py_XDECREF(reduce_cython);
  21366. Py_XDECREF(setstate);
  21367. Py_XDECREF(setstate_cython);
  21368. return ret;
  21369. }
  21370. /* TypeImport */
  21371. #ifndef __PYX_HAVE_RT_ImportType
  21372. #define __PYX_HAVE_RT_ImportType
  21373. static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
  21374. size_t size, enum __Pyx_ImportType_CheckSize check_size)
  21375. {
  21376. PyObject *result = 0;
  21377. char warning[200];
  21378. Py_ssize_t basicsize;
  21379. #ifdef Py_LIMITED_API
  21380. PyObject *py_basicsize;
  21381. #endif
  21382. result = PyObject_GetAttrString(module, class_name);
  21383. if (!result)
  21384. goto bad;
  21385. if (!PyType_Check(result)) {
  21386. PyErr_Format(PyExc_TypeError,
  21387. "%.200s.%.200s is not a type object",
  21388. module_name, class_name);
  21389. goto bad;
  21390. }
  21391. #ifndef Py_LIMITED_API
  21392. basicsize = ((PyTypeObject *)result)->tp_basicsize;
  21393. #else
  21394. py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
  21395. if (!py_basicsize)
  21396. goto bad;
  21397. basicsize = PyLong_AsSsize_t(py_basicsize);
  21398. Py_DECREF(py_basicsize);
  21399. py_basicsize = 0;
  21400. if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
  21401. goto bad;
  21402. #endif
  21403. if ((size_t)basicsize < size) {
  21404. PyErr_Format(PyExc_ValueError,
  21405. "%.200s.%.200s size changed, may indicate binary incompatibility. "
  21406. "Expected %zd from C header, got %zd from PyObject",
  21407. module_name, class_name, size, basicsize);
  21408. goto bad;
  21409. }
  21410. if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
  21411. PyErr_Format(PyExc_ValueError,
  21412. "%.200s.%.200s size changed, may indicate binary incompatibility. "
  21413. "Expected %zd from C header, got %zd from PyObject",
  21414. module_name, class_name, size, basicsize);
  21415. goto bad;
  21416. }
  21417. else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
  21418. PyOS_snprintf(warning, sizeof(warning),
  21419. "%s.%s size changed, may indicate binary incompatibility. "
  21420. "Expected %zd from C header, got %zd from PyObject",
  21421. module_name, class_name, size, basicsize);
  21422. if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
  21423. }
  21424. return (PyTypeObject *)result;
  21425. bad:
  21426. Py_XDECREF(result);
  21427. return NULL;
  21428. }
  21429. #endif
  21430. /* CLineInTraceback */
  21431. #ifndef CYTHON_CLINE_IN_TRACEBACK
  21432. static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  21433. PyObject *use_cline;
  21434. PyObject *ptype, *pvalue, *ptraceback;
  21435. #if CYTHON_COMPILING_IN_CPYTHON
  21436. PyObject **cython_runtime_dict;
  21437. #endif
  21438. if (unlikely(!__pyx_cython_runtime)) {
  21439. return c_line;
  21440. }
  21441. __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
  21442. #if CYTHON_COMPILING_IN_CPYTHON
  21443. cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
  21444. if (likely(cython_runtime_dict)) {
  21445. __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
  21446. use_cline, *cython_runtime_dict,
  21447. __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
  21448. } else
  21449. #endif
  21450. {
  21451. PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
  21452. if (use_cline_obj) {
  21453. use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
  21454. Py_DECREF(use_cline_obj);
  21455. } else {
  21456. PyErr_Clear();
  21457. use_cline = NULL;
  21458. }
  21459. }
  21460. if (!use_cline) {
  21461. c_line = 0;
  21462. PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
  21463. }
  21464. else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
  21465. c_line = 0;
  21466. }
  21467. __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
  21468. return c_line;
  21469. }
  21470. #endif
  21471. /* CodeObjectCache */
  21472. static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
  21473. int start = 0, mid = 0, end = count - 1;
  21474. if (end >= 0 && code_line > entries[end].code_line) {
  21475. return count;
  21476. }
  21477. while (start < end) {
  21478. mid = start + (end - start) / 2;
  21479. if (code_line < entries[mid].code_line) {
  21480. end = mid;
  21481. } else if (code_line > entries[mid].code_line) {
  21482. start = mid + 1;
  21483. } else {
  21484. return mid;
  21485. }
  21486. }
  21487. if (code_line <= entries[mid].code_line) {
  21488. return mid;
  21489. } else {
  21490. return mid + 1;
  21491. }
  21492. }
  21493. static PyCodeObject *__pyx_find_code_object(int code_line) {
  21494. PyCodeObject* code_object;
  21495. int pos;
  21496. if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
  21497. return NULL;
  21498. }
  21499. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  21500. if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
  21501. return NULL;
  21502. }
  21503. code_object = __pyx_code_cache.entries[pos].code_object;
  21504. Py_INCREF(code_object);
  21505. return code_object;
  21506. }
  21507. static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
  21508. int pos, i;
  21509. __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
  21510. if (unlikely(!code_line)) {
  21511. return;
  21512. }
  21513. if (unlikely(!entries)) {
  21514. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
  21515. if (likely(entries)) {
  21516. __pyx_code_cache.entries = entries;
  21517. __pyx_code_cache.max_count = 64;
  21518. __pyx_code_cache.count = 1;
  21519. entries[0].code_line = code_line;
  21520. entries[0].code_object = code_object;
  21521. Py_INCREF(code_object);
  21522. }
  21523. return;
  21524. }
  21525. pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
  21526. if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
  21527. PyCodeObject* tmp = entries[pos].code_object;
  21528. entries[pos].code_object = code_object;
  21529. Py_DECREF(tmp);
  21530. return;
  21531. }
  21532. if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
  21533. int new_max = __pyx_code_cache.max_count + 64;
  21534. entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
  21535. __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
  21536. if (unlikely(!entries)) {
  21537. return;
  21538. }
  21539. __pyx_code_cache.entries = entries;
  21540. __pyx_code_cache.max_count = new_max;
  21541. }
  21542. for (i=__pyx_code_cache.count; i>pos; i--) {
  21543. entries[i] = entries[i-1];
  21544. }
  21545. entries[pos].code_line = code_line;
  21546. entries[pos].code_object = code_object;
  21547. __pyx_code_cache.count++;
  21548. Py_INCREF(code_object);
  21549. }
  21550. /* AddTraceback */
  21551. #include "compile.h"
  21552. #include "frameobject.h"
  21553. #include "traceback.h"
  21554. static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  21555. const char *funcname, int c_line,
  21556. int py_line, const char *filename) {
  21557. PyCodeObject *py_code = 0;
  21558. PyObject *py_srcfile = 0;
  21559. PyObject *py_funcname = 0;
  21560. #if PY_MAJOR_VERSION < 3
  21561. py_srcfile = PyString_FromString(filename);
  21562. #else
  21563. py_srcfile = PyUnicode_FromString(filename);
  21564. #endif
  21565. if (!py_srcfile) goto bad;
  21566. if (c_line) {
  21567. #if PY_MAJOR_VERSION < 3
  21568. py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  21569. #else
  21570. py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
  21571. #endif
  21572. }
  21573. else {
  21574. #if PY_MAJOR_VERSION < 3
  21575. py_funcname = PyString_FromString(funcname);
  21576. #else
  21577. py_funcname = PyUnicode_FromString(funcname);
  21578. #endif
  21579. }
  21580. if (!py_funcname) goto bad;
  21581. py_code = __Pyx_PyCode_New(
  21582. 0,
  21583. 0,
  21584. 0,
  21585. 0,
  21586. 0,
  21587. __pyx_empty_bytes, /*PyObject *code,*/
  21588. __pyx_empty_tuple, /*PyObject *consts,*/
  21589. __pyx_empty_tuple, /*PyObject *names,*/
  21590. __pyx_empty_tuple, /*PyObject *varnames,*/
  21591. __pyx_empty_tuple, /*PyObject *freevars,*/
  21592. __pyx_empty_tuple, /*PyObject *cellvars,*/
  21593. py_srcfile, /*PyObject *filename,*/
  21594. py_funcname, /*PyObject *name,*/
  21595. py_line,
  21596. __pyx_empty_bytes /*PyObject *lnotab*/
  21597. );
  21598. Py_DECREF(py_srcfile);
  21599. Py_DECREF(py_funcname);
  21600. return py_code;
  21601. bad:
  21602. Py_XDECREF(py_srcfile);
  21603. Py_XDECREF(py_funcname);
  21604. return NULL;
  21605. }
  21606. static void __Pyx_AddTraceback(const char *funcname, int c_line,
  21607. int py_line, const char *filename) {
  21608. PyCodeObject *py_code = 0;
  21609. PyFrameObject *py_frame = 0;
  21610. PyThreadState *tstate = __Pyx_PyThreadState_Current;
  21611. if (c_line) {
  21612. c_line = __Pyx_CLineForTraceback(tstate, c_line);
  21613. }
  21614. py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
  21615. if (!py_code) {
  21616. py_code = __Pyx_CreateCodeObjectForTraceback(
  21617. funcname, c_line, py_line, filename);
  21618. if (!py_code) goto bad;
  21619. __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
  21620. }
  21621. py_frame = PyFrame_New(
  21622. tstate, /*PyThreadState *tstate,*/
  21623. py_code, /*PyCodeObject *code,*/
  21624. __pyx_d, /*PyObject *globals,*/
  21625. 0 /*PyObject *locals*/
  21626. );
  21627. if (!py_frame) goto bad;
  21628. __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
  21629. PyTraceBack_Here(py_frame);
  21630. bad:
  21631. Py_XDECREF(py_code);
  21632. Py_XDECREF(py_frame);
  21633. }
  21634. #if PY_MAJOR_VERSION < 3
  21635. static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  21636. if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
  21637. if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
  21638. if (__Pyx_TypeCheck(obj, __pyx_array_type)) return __pyx_array_getbuffer(obj, view, flags);
  21639. if (__Pyx_TypeCheck(obj, __pyx_memoryview_type)) return __pyx_memoryview_getbuffer(obj, view, flags);
  21640. PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
  21641. return -1;
  21642. }
  21643. static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  21644. PyObject *obj = view->obj;
  21645. if (!obj) return;
  21646. if (PyObject_CheckBuffer(obj)) {
  21647. PyBuffer_Release(view);
  21648. return;
  21649. }
  21650. if ((0)) {}
  21651. else if (__Pyx_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view);
  21652. view->obj = NULL;
  21653. Py_DECREF(obj);
  21654. }
  21655. #endif
  21656. /* MemviewSliceIsContig */
  21657. static int
  21658. __pyx_memviewslice_is_contig(const __Pyx_memviewslice mvs, char order, int ndim)
  21659. {
  21660. int i, index, step, start;
  21661. Py_ssize_t itemsize = mvs.memview->view.itemsize;
  21662. if (order == 'F') {
  21663. step = 1;
  21664. start = 0;
  21665. } else {
  21666. step = -1;
  21667. start = ndim - 1;
  21668. }
  21669. for (i = 0; i < ndim; i++) {
  21670. index = start + step * i;
  21671. if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
  21672. return 0;
  21673. itemsize *= mvs.shape[index];
  21674. }
  21675. return 1;
  21676. }
  21677. /* OverlappingSlices */
  21678. static void
  21679. __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
  21680. void **out_start, void **out_end,
  21681. int ndim, size_t itemsize)
  21682. {
  21683. char *start, *end;
  21684. int i;
  21685. start = end = slice->data;
  21686. for (i = 0; i < ndim; i++) {
  21687. Py_ssize_t stride = slice->strides[i];
  21688. Py_ssize_t extent = slice->shape[i];
  21689. if (extent == 0) {
  21690. *out_start = *out_end = start;
  21691. return;
  21692. } else {
  21693. if (stride > 0)
  21694. end += stride * (extent - 1);
  21695. else
  21696. start += stride * (extent - 1);
  21697. }
  21698. }
  21699. *out_start = start;
  21700. *out_end = end + itemsize;
  21701. }
  21702. static int
  21703. __pyx_slices_overlap(__Pyx_memviewslice *slice1,
  21704. __Pyx_memviewslice *slice2,
  21705. int ndim, size_t itemsize)
  21706. {
  21707. void *start1, *end1, *start2, *end2;
  21708. __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
  21709. __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
  21710. return (start1 < end2) && (start2 < end1);
  21711. }
  21712. /* Capsule */
  21713. static CYTHON_INLINE PyObject *
  21714. __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig)
  21715. {
  21716. PyObject *cobj;
  21717. #if PY_VERSION_HEX >= 0x02070000
  21718. cobj = PyCapsule_New(p, sig, NULL);
  21719. #else
  21720. cobj = PyCObject_FromVoidPtr(p, NULL);
  21721. #endif
  21722. return cobj;
  21723. }
  21724. /* CIntFromPyVerify */
  21725. #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
  21726. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
  21727. #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
  21728. __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
  21729. #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
  21730. {\
  21731. func_type value = func_value;\
  21732. if (sizeof(target_type) < sizeof(func_type)) {\
  21733. if (unlikely(value != (func_type) (target_type) value)) {\
  21734. func_type zero = 0;\
  21735. if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
  21736. return (target_type) -1;\
  21737. if (is_unsigned && unlikely(value < zero))\
  21738. goto raise_neg_overflow;\
  21739. else\
  21740. goto raise_overflow;\
  21741. }\
  21742. }\
  21743. return (target_type) value;\
  21744. }
  21745. /* CIntToPy */
  21746. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  21747. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  21748. const int is_unsigned = neg_one > const_zero;
  21749. if (is_unsigned) {
  21750. if (sizeof(int) < sizeof(long)) {
  21751. return PyInt_FromLong((long) value);
  21752. } else if (sizeof(int) <= sizeof(unsigned long)) {
  21753. return PyLong_FromUnsignedLong((unsigned long) value);
  21754. #ifdef HAVE_LONG_LONG
  21755. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  21756. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  21757. #endif
  21758. }
  21759. } else {
  21760. if (sizeof(int) <= sizeof(long)) {
  21761. return PyInt_FromLong((long) value);
  21762. #ifdef HAVE_LONG_LONG
  21763. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  21764. return PyLong_FromLongLong((PY_LONG_LONG) value);
  21765. #endif
  21766. }
  21767. }
  21768. {
  21769. int one = 1; int little = (int)*(unsigned char *)&one;
  21770. unsigned char *bytes = (unsigned char *)&value;
  21771. return _PyLong_FromByteArray(bytes, sizeof(int),
  21772. little, !is_unsigned);
  21773. }
  21774. }
  21775. /* Declarations */
  21776. #if CYTHON_CCOMPLEX
  21777. #ifdef __cplusplus
  21778. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  21779. return ::std::complex< float >(x, y);
  21780. }
  21781. #else
  21782. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  21783. return x + y*(__pyx_t_float_complex)_Complex_I;
  21784. }
  21785. #endif
  21786. #else
  21787. static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
  21788. __pyx_t_float_complex z;
  21789. z.real = x;
  21790. z.imag = y;
  21791. return z;
  21792. }
  21793. #endif
  21794. /* Arithmetic */
  21795. #if CYTHON_CCOMPLEX
  21796. #else
  21797. static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  21798. return (a.real == b.real) && (a.imag == b.imag);
  21799. }
  21800. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  21801. __pyx_t_float_complex z;
  21802. z.real = a.real + b.real;
  21803. z.imag = a.imag + b.imag;
  21804. return z;
  21805. }
  21806. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  21807. __pyx_t_float_complex z;
  21808. z.real = a.real - b.real;
  21809. z.imag = a.imag - b.imag;
  21810. return z;
  21811. }
  21812. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  21813. __pyx_t_float_complex z;
  21814. z.real = a.real * b.real - a.imag * b.imag;
  21815. z.imag = a.real * b.imag + a.imag * b.real;
  21816. return z;
  21817. }
  21818. #if 1
  21819. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  21820. if (b.imag == 0) {
  21821. return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
  21822. } else if (fabsf(b.real) >= fabsf(b.imag)) {
  21823. if (b.real == 0 && b.imag == 0) {
  21824. return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
  21825. } else {
  21826. float r = b.imag / b.real;
  21827. float s = (float)(1.0) / (b.real + b.imag * r);
  21828. return __pyx_t_float_complex_from_parts(
  21829. (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  21830. }
  21831. } else {
  21832. float r = b.real / b.imag;
  21833. float s = (float)(1.0) / (b.imag + b.real * r);
  21834. return __pyx_t_float_complex_from_parts(
  21835. (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  21836. }
  21837. }
  21838. #else
  21839. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  21840. if (b.imag == 0) {
  21841. return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
  21842. } else {
  21843. float denom = b.real * b.real + b.imag * b.imag;
  21844. return __pyx_t_float_complex_from_parts(
  21845. (a.real * b.real + a.imag * b.imag) / denom,
  21846. (a.imag * b.real - a.real * b.imag) / denom);
  21847. }
  21848. }
  21849. #endif
  21850. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
  21851. __pyx_t_float_complex z;
  21852. z.real = -a.real;
  21853. z.imag = -a.imag;
  21854. return z;
  21855. }
  21856. static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
  21857. return (a.real == 0) && (a.imag == 0);
  21858. }
  21859. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
  21860. __pyx_t_float_complex z;
  21861. z.real = a.real;
  21862. z.imag = -a.imag;
  21863. return z;
  21864. }
  21865. #if 1
  21866. static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
  21867. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  21868. return sqrtf(z.real*z.real + z.imag*z.imag);
  21869. #else
  21870. return hypotf(z.real, z.imag);
  21871. #endif
  21872. }
  21873. static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
  21874. __pyx_t_float_complex z;
  21875. float r, lnr, theta, z_r, z_theta;
  21876. if (b.imag == 0 && b.real == (int)b.real) {
  21877. if (b.real < 0) {
  21878. float denom = a.real * a.real + a.imag * a.imag;
  21879. a.real = a.real / denom;
  21880. a.imag = -a.imag / denom;
  21881. b.real = -b.real;
  21882. }
  21883. switch ((int)b.real) {
  21884. case 0:
  21885. z.real = 1;
  21886. z.imag = 0;
  21887. return z;
  21888. case 1:
  21889. return a;
  21890. case 2:
  21891. return __Pyx_c_prod_float(a, a);
  21892. case 3:
  21893. z = __Pyx_c_prod_float(a, a);
  21894. return __Pyx_c_prod_float(z, a);
  21895. case 4:
  21896. z = __Pyx_c_prod_float(a, a);
  21897. return __Pyx_c_prod_float(z, z);
  21898. }
  21899. }
  21900. if (a.imag == 0) {
  21901. if (a.real == 0) {
  21902. return a;
  21903. } else if (b.imag == 0) {
  21904. z.real = powf(a.real, b.real);
  21905. z.imag = 0;
  21906. return z;
  21907. } else if (a.real > 0) {
  21908. r = a.real;
  21909. theta = 0;
  21910. } else {
  21911. r = -a.real;
  21912. theta = atan2f(0.0, -1.0);
  21913. }
  21914. } else {
  21915. r = __Pyx_c_abs_float(a);
  21916. theta = atan2f(a.imag, a.real);
  21917. }
  21918. lnr = logf(r);
  21919. z_r = expf(lnr * b.real - theta * b.imag);
  21920. z_theta = theta * b.real + lnr * b.imag;
  21921. z.real = z_r * cosf(z_theta);
  21922. z.imag = z_r * sinf(z_theta);
  21923. return z;
  21924. }
  21925. #endif
  21926. #endif
  21927. /* Declarations */
  21928. #if CYTHON_CCOMPLEX
  21929. #ifdef __cplusplus
  21930. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  21931. return ::std::complex< double >(x, y);
  21932. }
  21933. #else
  21934. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  21935. return x + y*(__pyx_t_double_complex)_Complex_I;
  21936. }
  21937. #endif
  21938. #else
  21939. static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
  21940. __pyx_t_double_complex z;
  21941. z.real = x;
  21942. z.imag = y;
  21943. return z;
  21944. }
  21945. #endif
  21946. /* Arithmetic */
  21947. #if CYTHON_CCOMPLEX
  21948. #else
  21949. static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  21950. return (a.real == b.real) && (a.imag == b.imag);
  21951. }
  21952. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  21953. __pyx_t_double_complex z;
  21954. z.real = a.real + b.real;
  21955. z.imag = a.imag + b.imag;
  21956. return z;
  21957. }
  21958. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  21959. __pyx_t_double_complex z;
  21960. z.real = a.real - b.real;
  21961. z.imag = a.imag - b.imag;
  21962. return z;
  21963. }
  21964. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  21965. __pyx_t_double_complex z;
  21966. z.real = a.real * b.real - a.imag * b.imag;
  21967. z.imag = a.real * b.imag + a.imag * b.real;
  21968. return z;
  21969. }
  21970. #if 1
  21971. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  21972. if (b.imag == 0) {
  21973. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  21974. } else if (fabs(b.real) >= fabs(b.imag)) {
  21975. if (b.real == 0 && b.imag == 0) {
  21976. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
  21977. } else {
  21978. double r = b.imag / b.real;
  21979. double s = (double)(1.0) / (b.real + b.imag * r);
  21980. return __pyx_t_double_complex_from_parts(
  21981. (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
  21982. }
  21983. } else {
  21984. double r = b.real / b.imag;
  21985. double s = (double)(1.0) / (b.imag + b.real * r);
  21986. return __pyx_t_double_complex_from_parts(
  21987. (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
  21988. }
  21989. }
  21990. #else
  21991. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  21992. if (b.imag == 0) {
  21993. return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
  21994. } else {
  21995. double denom = b.real * b.real + b.imag * b.imag;
  21996. return __pyx_t_double_complex_from_parts(
  21997. (a.real * b.real + a.imag * b.imag) / denom,
  21998. (a.imag * b.real - a.real * b.imag) / denom);
  21999. }
  22000. }
  22001. #endif
  22002. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
  22003. __pyx_t_double_complex z;
  22004. z.real = -a.real;
  22005. z.imag = -a.imag;
  22006. return z;
  22007. }
  22008. static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
  22009. return (a.real == 0) && (a.imag == 0);
  22010. }
  22011. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
  22012. __pyx_t_double_complex z;
  22013. z.real = a.real;
  22014. z.imag = -a.imag;
  22015. return z;
  22016. }
  22017. #if 1
  22018. static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
  22019. #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
  22020. return sqrt(z.real*z.real + z.imag*z.imag);
  22021. #else
  22022. return hypot(z.real, z.imag);
  22023. #endif
  22024. }
  22025. static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
  22026. __pyx_t_double_complex z;
  22027. double r, lnr, theta, z_r, z_theta;
  22028. if (b.imag == 0 && b.real == (int)b.real) {
  22029. if (b.real < 0) {
  22030. double denom = a.real * a.real + a.imag * a.imag;
  22031. a.real = a.real / denom;
  22032. a.imag = -a.imag / denom;
  22033. b.real = -b.real;
  22034. }
  22035. switch ((int)b.real) {
  22036. case 0:
  22037. z.real = 1;
  22038. z.imag = 0;
  22039. return z;
  22040. case 1:
  22041. return a;
  22042. case 2:
  22043. return __Pyx_c_prod_double(a, a);
  22044. case 3:
  22045. z = __Pyx_c_prod_double(a, a);
  22046. return __Pyx_c_prod_double(z, a);
  22047. case 4:
  22048. z = __Pyx_c_prod_double(a, a);
  22049. return __Pyx_c_prod_double(z, z);
  22050. }
  22051. }
  22052. if (a.imag == 0) {
  22053. if (a.real == 0) {
  22054. return a;
  22055. } else if (b.imag == 0) {
  22056. z.real = pow(a.real, b.real);
  22057. z.imag = 0;
  22058. return z;
  22059. } else if (a.real > 0) {
  22060. r = a.real;
  22061. theta = 0;
  22062. } else {
  22063. r = -a.real;
  22064. theta = atan2(0.0, -1.0);
  22065. }
  22066. } else {
  22067. r = __Pyx_c_abs_double(a);
  22068. theta = atan2(a.imag, a.real);
  22069. }
  22070. lnr = log(r);
  22071. z_r = exp(lnr * b.real - theta * b.imag);
  22072. z_theta = theta * b.real + lnr * b.imag;
  22073. z.real = z_r * cos(z_theta);
  22074. z.imag = z_r * sin(z_theta);
  22075. return z;
  22076. }
  22077. #endif
  22078. #endif
  22079. /* CIntToPy */
  22080. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
  22081. const enum NPY_TYPES neg_one = (enum NPY_TYPES) ((enum NPY_TYPES) 0 - (enum NPY_TYPES) 1), const_zero = (enum NPY_TYPES) 0;
  22082. const int is_unsigned = neg_one > const_zero;
  22083. if (is_unsigned) {
  22084. if (sizeof(enum NPY_TYPES) < sizeof(long)) {
  22085. return PyInt_FromLong((long) value);
  22086. } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
  22087. return PyLong_FromUnsignedLong((unsigned long) value);
  22088. #ifdef HAVE_LONG_LONG
  22089. } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
  22090. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  22091. #endif
  22092. }
  22093. } else {
  22094. if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
  22095. return PyInt_FromLong((long) value);
  22096. #ifdef HAVE_LONG_LONG
  22097. } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
  22098. return PyLong_FromLongLong((PY_LONG_LONG) value);
  22099. #endif
  22100. }
  22101. }
  22102. {
  22103. int one = 1; int little = (int)*(unsigned char *)&one;
  22104. unsigned char *bytes = (unsigned char *)&value;
  22105. return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
  22106. little, !is_unsigned);
  22107. }
  22108. }
  22109. /* MemviewSliceCopyTemplate */
  22110. static __Pyx_memviewslice
  22111. __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
  22112. const char *mode, int ndim,
  22113. size_t sizeof_dtype, int contig_flag,
  22114. int dtype_is_object)
  22115. {
  22116. __Pyx_RefNannyDeclarations
  22117. int i;
  22118. __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
  22119. struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
  22120. Py_buffer *buf = &from_memview->view;
  22121. PyObject *shape_tuple = NULL;
  22122. PyObject *temp_int = NULL;
  22123. struct __pyx_array_obj *array_obj = NULL;
  22124. struct __pyx_memoryview_obj *memview_obj = NULL;
  22125. __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0);
  22126. for (i = 0; i < ndim; i++) {
  22127. if (from_mvs->suboffsets[i] >= 0) {
  22128. PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with "
  22129. "indirect dimensions (axis %d)", i);
  22130. goto fail;
  22131. }
  22132. }
  22133. shape_tuple = PyTuple_New(ndim);
  22134. if (unlikely(!shape_tuple)) {
  22135. goto fail;
  22136. }
  22137. __Pyx_GOTREF(shape_tuple);
  22138. for(i = 0; i < ndim; i++) {
  22139. temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
  22140. if(unlikely(!temp_int)) {
  22141. goto fail;
  22142. } else {
  22143. PyTuple_SET_ITEM(shape_tuple, i, temp_int);
  22144. temp_int = NULL;
  22145. }
  22146. }
  22147. array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (char *) mode, NULL);
  22148. if (unlikely(!array_obj)) {
  22149. goto fail;
  22150. }
  22151. __Pyx_GOTREF(array_obj);
  22152. memview_obj = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
  22153. (PyObject *) array_obj, contig_flag,
  22154. dtype_is_object,
  22155. from_mvs->memview->typeinfo);
  22156. if (unlikely(!memview_obj))
  22157. goto fail;
  22158. if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
  22159. goto fail;
  22160. if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
  22161. dtype_is_object) < 0))
  22162. goto fail;
  22163. goto no_fail;
  22164. fail:
  22165. __Pyx_XDECREF(new_mvs.memview);
  22166. new_mvs.memview = NULL;
  22167. new_mvs.data = NULL;
  22168. no_fail:
  22169. __Pyx_XDECREF(shape_tuple);
  22170. __Pyx_XDECREF(temp_int);
  22171. __Pyx_XDECREF(array_obj);
  22172. __Pyx_RefNannyFinishContext();
  22173. return new_mvs;
  22174. }
  22175. /* CIntFromPy */
  22176. static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
  22177. const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
  22178. const int is_unsigned = neg_one > const_zero;
  22179. #if PY_MAJOR_VERSION < 3
  22180. if (likely(PyInt_Check(x))) {
  22181. if (sizeof(int) < sizeof(long)) {
  22182. __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
  22183. } else {
  22184. long val = PyInt_AS_LONG(x);
  22185. if (is_unsigned && unlikely(val < 0)) {
  22186. goto raise_neg_overflow;
  22187. }
  22188. return (int) val;
  22189. }
  22190. } else
  22191. #endif
  22192. if (likely(PyLong_Check(x))) {
  22193. if (is_unsigned) {
  22194. #if CYTHON_USE_PYLONG_INTERNALS
  22195. const digit* digits = ((PyLongObject*)x)->ob_digit;
  22196. switch (Py_SIZE(x)) {
  22197. case 0: return (int) 0;
  22198. case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
  22199. case 2:
  22200. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  22201. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22202. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22203. } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
  22204. return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  22205. }
  22206. }
  22207. break;
  22208. case 3:
  22209. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  22210. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22211. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22212. } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
  22213. return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  22214. }
  22215. }
  22216. break;
  22217. case 4:
  22218. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  22219. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22220. __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])))
  22221. } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
  22222. return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
  22223. }
  22224. }
  22225. break;
  22226. }
  22227. #endif
  22228. #if CYTHON_COMPILING_IN_CPYTHON
  22229. if (unlikely(Py_SIZE(x) < 0)) {
  22230. goto raise_neg_overflow;
  22231. }
  22232. #else
  22233. {
  22234. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  22235. if (unlikely(result < 0))
  22236. return (int) -1;
  22237. if (unlikely(result == 1))
  22238. goto raise_neg_overflow;
  22239. }
  22240. #endif
  22241. if (sizeof(int) <= sizeof(unsigned long)) {
  22242. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
  22243. #ifdef HAVE_LONG_LONG
  22244. } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
  22245. __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  22246. #endif
  22247. }
  22248. } else {
  22249. #if CYTHON_USE_PYLONG_INTERNALS
  22250. const digit* digits = ((PyLongObject*)x)->ob_digit;
  22251. switch (Py_SIZE(x)) {
  22252. case 0: return (int) 0;
  22253. case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
  22254. case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
  22255. case -2:
  22256. if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
  22257. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22258. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22259. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  22260. return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  22261. }
  22262. }
  22263. break;
  22264. case 2:
  22265. if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
  22266. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22267. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22268. } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  22269. return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  22270. }
  22271. }
  22272. break;
  22273. case -3:
  22274. if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
  22275. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22276. __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22277. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  22278. return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  22279. }
  22280. }
  22281. break;
  22282. case 3:
  22283. if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
  22284. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22285. __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22286. } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  22287. return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  22288. }
  22289. }
  22290. break;
  22291. case -4:
  22292. if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
  22293. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22294. __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])))
  22295. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  22296. return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  22297. }
  22298. }
  22299. break;
  22300. case 4:
  22301. if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
  22302. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22303. __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])))
  22304. } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
  22305. return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
  22306. }
  22307. }
  22308. break;
  22309. }
  22310. #endif
  22311. if (sizeof(int) <= sizeof(long)) {
  22312. __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
  22313. #ifdef HAVE_LONG_LONG
  22314. } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
  22315. __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
  22316. #endif
  22317. }
  22318. }
  22319. {
  22320. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  22321. PyErr_SetString(PyExc_RuntimeError,
  22322. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  22323. #else
  22324. int val;
  22325. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  22326. #if PY_MAJOR_VERSION < 3
  22327. if (likely(v) && !PyLong_Check(v)) {
  22328. PyObject *tmp = v;
  22329. v = PyNumber_Long(tmp);
  22330. Py_DECREF(tmp);
  22331. }
  22332. #endif
  22333. if (likely(v)) {
  22334. int one = 1; int is_little = (int)*(unsigned char *)&one;
  22335. unsigned char *bytes = (unsigned char *)&val;
  22336. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  22337. bytes, sizeof(val),
  22338. is_little, !is_unsigned);
  22339. Py_DECREF(v);
  22340. if (likely(!ret))
  22341. return val;
  22342. }
  22343. #endif
  22344. return (int) -1;
  22345. }
  22346. } else {
  22347. int val;
  22348. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  22349. if (!tmp) return (int) -1;
  22350. val = __Pyx_PyInt_As_int(tmp);
  22351. Py_DECREF(tmp);
  22352. return val;
  22353. }
  22354. raise_overflow:
  22355. PyErr_SetString(PyExc_OverflowError,
  22356. "value too large to convert to int");
  22357. return (int) -1;
  22358. raise_neg_overflow:
  22359. PyErr_SetString(PyExc_OverflowError,
  22360. "can't convert negative value to int");
  22361. return (int) -1;
  22362. }
  22363. /* CIntFromPy */
  22364. static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
  22365. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  22366. const int is_unsigned = neg_one > const_zero;
  22367. #if PY_MAJOR_VERSION < 3
  22368. if (likely(PyInt_Check(x))) {
  22369. if (sizeof(long) < sizeof(long)) {
  22370. __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
  22371. } else {
  22372. long val = PyInt_AS_LONG(x);
  22373. if (is_unsigned && unlikely(val < 0)) {
  22374. goto raise_neg_overflow;
  22375. }
  22376. return (long) val;
  22377. }
  22378. } else
  22379. #endif
  22380. if (likely(PyLong_Check(x))) {
  22381. if (is_unsigned) {
  22382. #if CYTHON_USE_PYLONG_INTERNALS
  22383. const digit* digits = ((PyLongObject*)x)->ob_digit;
  22384. switch (Py_SIZE(x)) {
  22385. case 0: return (long) 0;
  22386. case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
  22387. case 2:
  22388. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  22389. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22390. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22391. } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
  22392. return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  22393. }
  22394. }
  22395. break;
  22396. case 3:
  22397. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  22398. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22399. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22400. } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
  22401. return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  22402. }
  22403. }
  22404. break;
  22405. case 4:
  22406. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  22407. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22408. __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])))
  22409. } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
  22410. return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
  22411. }
  22412. }
  22413. break;
  22414. }
  22415. #endif
  22416. #if CYTHON_COMPILING_IN_CPYTHON
  22417. if (unlikely(Py_SIZE(x) < 0)) {
  22418. goto raise_neg_overflow;
  22419. }
  22420. #else
  22421. {
  22422. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  22423. if (unlikely(result < 0))
  22424. return (long) -1;
  22425. if (unlikely(result == 1))
  22426. goto raise_neg_overflow;
  22427. }
  22428. #endif
  22429. if (sizeof(long) <= sizeof(unsigned long)) {
  22430. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
  22431. #ifdef HAVE_LONG_LONG
  22432. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  22433. __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  22434. #endif
  22435. }
  22436. } else {
  22437. #if CYTHON_USE_PYLONG_INTERNALS
  22438. const digit* digits = ((PyLongObject*)x)->ob_digit;
  22439. switch (Py_SIZE(x)) {
  22440. case 0: return (long) 0;
  22441. case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
  22442. case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
  22443. case -2:
  22444. if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
  22445. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22446. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22447. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  22448. return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  22449. }
  22450. }
  22451. break;
  22452. case 2:
  22453. if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
  22454. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22455. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22456. } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  22457. return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  22458. }
  22459. }
  22460. break;
  22461. case -3:
  22462. if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
  22463. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22464. __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22465. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  22466. return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  22467. }
  22468. }
  22469. break;
  22470. case 3:
  22471. if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
  22472. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22473. __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22474. } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  22475. return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  22476. }
  22477. }
  22478. break;
  22479. case -4:
  22480. if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
  22481. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22482. __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])))
  22483. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  22484. return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  22485. }
  22486. }
  22487. break;
  22488. case 4:
  22489. if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
  22490. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22491. __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])))
  22492. } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
  22493. return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
  22494. }
  22495. }
  22496. break;
  22497. }
  22498. #endif
  22499. if (sizeof(long) <= sizeof(long)) {
  22500. __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
  22501. #ifdef HAVE_LONG_LONG
  22502. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  22503. __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
  22504. #endif
  22505. }
  22506. }
  22507. {
  22508. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  22509. PyErr_SetString(PyExc_RuntimeError,
  22510. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  22511. #else
  22512. long val;
  22513. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  22514. #if PY_MAJOR_VERSION < 3
  22515. if (likely(v) && !PyLong_Check(v)) {
  22516. PyObject *tmp = v;
  22517. v = PyNumber_Long(tmp);
  22518. Py_DECREF(tmp);
  22519. }
  22520. #endif
  22521. if (likely(v)) {
  22522. int one = 1; int is_little = (int)*(unsigned char *)&one;
  22523. unsigned char *bytes = (unsigned char *)&val;
  22524. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  22525. bytes, sizeof(val),
  22526. is_little, !is_unsigned);
  22527. Py_DECREF(v);
  22528. if (likely(!ret))
  22529. return val;
  22530. }
  22531. #endif
  22532. return (long) -1;
  22533. }
  22534. } else {
  22535. long val;
  22536. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  22537. if (!tmp) return (long) -1;
  22538. val = __Pyx_PyInt_As_long(tmp);
  22539. Py_DECREF(tmp);
  22540. return val;
  22541. }
  22542. raise_overflow:
  22543. PyErr_SetString(PyExc_OverflowError,
  22544. "value too large to convert to long");
  22545. return (long) -1;
  22546. raise_neg_overflow:
  22547. PyErr_SetString(PyExc_OverflowError,
  22548. "can't convert negative value to long");
  22549. return (long) -1;
  22550. }
  22551. /* CIntToPy */
  22552. static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  22553. const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
  22554. const int is_unsigned = neg_one > const_zero;
  22555. if (is_unsigned) {
  22556. if (sizeof(long) < sizeof(long)) {
  22557. return PyInt_FromLong((long) value);
  22558. } else if (sizeof(long) <= sizeof(unsigned long)) {
  22559. return PyLong_FromUnsignedLong((unsigned long) value);
  22560. #ifdef HAVE_LONG_LONG
  22561. } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
  22562. return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
  22563. #endif
  22564. }
  22565. } else {
  22566. if (sizeof(long) <= sizeof(long)) {
  22567. return PyInt_FromLong((long) value);
  22568. #ifdef HAVE_LONG_LONG
  22569. } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
  22570. return PyLong_FromLongLong((PY_LONG_LONG) value);
  22571. #endif
  22572. }
  22573. }
  22574. {
  22575. int one = 1; int little = (int)*(unsigned char *)&one;
  22576. unsigned char *bytes = (unsigned char *)&value;
  22577. return _PyLong_FromByteArray(bytes, sizeof(long),
  22578. little, !is_unsigned);
  22579. }
  22580. }
  22581. /* CIntFromPy */
  22582. static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) {
  22583. const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0;
  22584. const int is_unsigned = neg_one > const_zero;
  22585. #if PY_MAJOR_VERSION < 3
  22586. if (likely(PyInt_Check(x))) {
  22587. if (sizeof(char) < sizeof(long)) {
  22588. __PYX_VERIFY_RETURN_INT(char, long, PyInt_AS_LONG(x))
  22589. } else {
  22590. long val = PyInt_AS_LONG(x);
  22591. if (is_unsigned && unlikely(val < 0)) {
  22592. goto raise_neg_overflow;
  22593. }
  22594. return (char) val;
  22595. }
  22596. } else
  22597. #endif
  22598. if (likely(PyLong_Check(x))) {
  22599. if (is_unsigned) {
  22600. #if CYTHON_USE_PYLONG_INTERNALS
  22601. const digit* digits = ((PyLongObject*)x)->ob_digit;
  22602. switch (Py_SIZE(x)) {
  22603. case 0: return (char) 0;
  22604. case 1: __PYX_VERIFY_RETURN_INT(char, digit, digits[0])
  22605. case 2:
  22606. if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
  22607. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22608. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22609. } else if (8 * sizeof(char) >= 2 * PyLong_SHIFT) {
  22610. return (char) (((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  22611. }
  22612. }
  22613. break;
  22614. case 3:
  22615. if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
  22616. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22617. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22618. } else if (8 * sizeof(char) >= 3 * PyLong_SHIFT) {
  22619. return (char) (((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  22620. }
  22621. }
  22622. break;
  22623. case 4:
  22624. if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
  22625. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22626. __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])))
  22627. } else if (8 * sizeof(char) >= 4 * PyLong_SHIFT) {
  22628. return (char) (((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
  22629. }
  22630. }
  22631. break;
  22632. }
  22633. #endif
  22634. #if CYTHON_COMPILING_IN_CPYTHON
  22635. if (unlikely(Py_SIZE(x) < 0)) {
  22636. goto raise_neg_overflow;
  22637. }
  22638. #else
  22639. {
  22640. int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
  22641. if (unlikely(result < 0))
  22642. return (char) -1;
  22643. if (unlikely(result == 1))
  22644. goto raise_neg_overflow;
  22645. }
  22646. #endif
  22647. if (sizeof(char) <= sizeof(unsigned long)) {
  22648. __PYX_VERIFY_RETURN_INT_EXC(char, unsigned long, PyLong_AsUnsignedLong(x))
  22649. #ifdef HAVE_LONG_LONG
  22650. } else if (sizeof(char) <= sizeof(unsigned PY_LONG_LONG)) {
  22651. __PYX_VERIFY_RETURN_INT_EXC(char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
  22652. #endif
  22653. }
  22654. } else {
  22655. #if CYTHON_USE_PYLONG_INTERNALS
  22656. const digit* digits = ((PyLongObject*)x)->ob_digit;
  22657. switch (Py_SIZE(x)) {
  22658. case 0: return (char) 0;
  22659. case -1: __PYX_VERIFY_RETURN_INT(char, sdigit, (sdigit) (-(sdigit)digits[0]))
  22660. case 1: __PYX_VERIFY_RETURN_INT(char, digit, +digits[0])
  22661. case -2:
  22662. if (8 * sizeof(char) - 1 > 1 * PyLong_SHIFT) {
  22663. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22664. __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22665. } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  22666. return (char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  22667. }
  22668. }
  22669. break;
  22670. case 2:
  22671. if (8 * sizeof(char) > 1 * PyLong_SHIFT) {
  22672. if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
  22673. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22674. } else if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  22675. return (char) ((((((char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  22676. }
  22677. }
  22678. break;
  22679. case -3:
  22680. if (8 * sizeof(char) - 1 > 2 * PyLong_SHIFT) {
  22681. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22682. __PYX_VERIFY_RETURN_INT(char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22683. } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  22684. return (char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  22685. }
  22686. }
  22687. break;
  22688. case 3:
  22689. if (8 * sizeof(char) > 2 * PyLong_SHIFT) {
  22690. if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
  22691. __PYX_VERIFY_RETURN_INT(char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
  22692. } else if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  22693. return (char) ((((((((char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  22694. }
  22695. }
  22696. break;
  22697. case -4:
  22698. if (8 * sizeof(char) - 1 > 3 * PyLong_SHIFT) {
  22699. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22700. __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])))
  22701. } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
  22702. return (char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  22703. }
  22704. }
  22705. break;
  22706. case 4:
  22707. if (8 * sizeof(char) > 3 * PyLong_SHIFT) {
  22708. if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
  22709. __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])))
  22710. } else if (8 * sizeof(char) - 1 > 4 * PyLong_SHIFT) {
  22711. return (char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
  22712. }
  22713. }
  22714. break;
  22715. }
  22716. #endif
  22717. if (sizeof(char) <= sizeof(long)) {
  22718. __PYX_VERIFY_RETURN_INT_EXC(char, long, PyLong_AsLong(x))
  22719. #ifdef HAVE_LONG_LONG
  22720. } else if (sizeof(char) <= sizeof(PY_LONG_LONG)) {
  22721. __PYX_VERIFY_RETURN_INT_EXC(char, PY_LONG_LONG, PyLong_AsLongLong(x))
  22722. #endif
  22723. }
  22724. }
  22725. {
  22726. #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
  22727. PyErr_SetString(PyExc_RuntimeError,
  22728. "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
  22729. #else
  22730. char val;
  22731. PyObject *v = __Pyx_PyNumber_IntOrLong(x);
  22732. #if PY_MAJOR_VERSION < 3
  22733. if (likely(v) && !PyLong_Check(v)) {
  22734. PyObject *tmp = v;
  22735. v = PyNumber_Long(tmp);
  22736. Py_DECREF(tmp);
  22737. }
  22738. #endif
  22739. if (likely(v)) {
  22740. int one = 1; int is_little = (int)*(unsigned char *)&one;
  22741. unsigned char *bytes = (unsigned char *)&val;
  22742. int ret = _PyLong_AsByteArray((PyLongObject *)v,
  22743. bytes, sizeof(val),
  22744. is_little, !is_unsigned);
  22745. Py_DECREF(v);
  22746. if (likely(!ret))
  22747. return val;
  22748. }
  22749. #endif
  22750. return (char) -1;
  22751. }
  22752. } else {
  22753. char val;
  22754. PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
  22755. if (!tmp) return (char) -1;
  22756. val = __Pyx_PyInt_As_char(tmp);
  22757. Py_DECREF(tmp);
  22758. return val;
  22759. }
  22760. raise_overflow:
  22761. PyErr_SetString(PyExc_OverflowError,
  22762. "value too large to convert to char");
  22763. return (char) -1;
  22764. raise_neg_overflow:
  22765. PyErr_SetString(PyExc_OverflowError,
  22766. "can't convert negative value to char");
  22767. return (char) -1;
  22768. }
  22769. /* IsLittleEndian */
  22770. static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
  22771. {
  22772. union {
  22773. uint32_t u32;
  22774. uint8_t u8[4];
  22775. } S;
  22776. S.u32 = 0x01020304;
  22777. return S.u8[0] == 4;
  22778. }
  22779. /* BufferFormatCheck */
  22780. static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  22781. __Pyx_BufFmt_StackElem* stack,
  22782. __Pyx_TypeInfo* type) {
  22783. stack[0].field = &ctx->root;
  22784. stack[0].parent_offset = 0;
  22785. ctx->root.type = type;
  22786. ctx->root.name = "buffer dtype";
  22787. ctx->root.offset = 0;
  22788. ctx->head = stack;
  22789. ctx->head->field = &ctx->root;
  22790. ctx->fmt_offset = 0;
  22791. ctx->head->parent_offset = 0;
  22792. ctx->new_packmode = '@';
  22793. ctx->enc_packmode = '@';
  22794. ctx->new_count = 1;
  22795. ctx->enc_count = 0;
  22796. ctx->enc_type = 0;
  22797. ctx->is_complex = 0;
  22798. ctx->is_valid_array = 0;
  22799. ctx->struct_alignment = 0;
  22800. while (type->typegroup == 'S') {
  22801. ++ctx->head;
  22802. ctx->head->field = type->fields;
  22803. ctx->head->parent_offset = 0;
  22804. type = type->fields->type;
  22805. }
  22806. }
  22807. static int __Pyx_BufFmt_ParseNumber(const char** ts) {
  22808. int count;
  22809. const char* t = *ts;
  22810. if (*t < '0' || *t > '9') {
  22811. return -1;
  22812. } else {
  22813. count = *t++ - '0';
  22814. while (*t >= '0' && *t <= '9') {
  22815. count *= 10;
  22816. count += *t++ - '0';
  22817. }
  22818. }
  22819. *ts = t;
  22820. return count;
  22821. }
  22822. static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
  22823. int number = __Pyx_BufFmt_ParseNumber(ts);
  22824. if (number == -1)
  22825. PyErr_Format(PyExc_ValueError,\
  22826. "Does not understand character buffer dtype format string ('%c')", **ts);
  22827. return number;
  22828. }
  22829. static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  22830. PyErr_Format(PyExc_ValueError,
  22831. "Unexpected format string character: '%c'", ch);
  22832. }
  22833. static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
  22834. switch (ch) {
  22835. case '?': return "'bool'";
  22836. case 'c': return "'char'";
  22837. case 'b': return "'signed char'";
  22838. case 'B': return "'unsigned char'";
  22839. case 'h': return "'short'";
  22840. case 'H': return "'unsigned short'";
  22841. case 'i': return "'int'";
  22842. case 'I': return "'unsigned int'";
  22843. case 'l': return "'long'";
  22844. case 'L': return "'unsigned long'";
  22845. case 'q': return "'long long'";
  22846. case 'Q': return "'unsigned long long'";
  22847. case 'f': return (is_complex ? "'complex float'" : "'float'");
  22848. case 'd': return (is_complex ? "'complex double'" : "'double'");
  22849. case 'g': return (is_complex ? "'complex long double'" : "'long double'");
  22850. case 'T': return "a struct";
  22851. case 'O': return "Python object";
  22852. case 'P': return "a pointer";
  22853. case 's': case 'p': return "a string";
  22854. case 0: return "end";
  22855. default: return "unparseable format string";
  22856. }
  22857. }
  22858. static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
  22859. switch (ch) {
  22860. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  22861. case 'h': case 'H': return 2;
  22862. case 'i': case 'I': case 'l': case 'L': return 4;
  22863. case 'q': case 'Q': return 8;
  22864. case 'f': return (is_complex ? 8 : 4);
  22865. case 'd': return (is_complex ? 16 : 8);
  22866. case 'g': {
  22867. PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
  22868. return 0;
  22869. }
  22870. case 'O': case 'P': return sizeof(void*);
  22871. default:
  22872. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  22873. return 0;
  22874. }
  22875. }
  22876. static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  22877. switch (ch) {
  22878. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  22879. case 'h': case 'H': return sizeof(short);
  22880. case 'i': case 'I': return sizeof(int);
  22881. case 'l': case 'L': return sizeof(long);
  22882. #ifdef HAVE_LONG_LONG
  22883. case 'q': case 'Q': return sizeof(PY_LONG_LONG);
  22884. #endif
  22885. case 'f': return sizeof(float) * (is_complex ? 2 : 1);
  22886. case 'd': return sizeof(double) * (is_complex ? 2 : 1);
  22887. case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
  22888. case 'O': case 'P': return sizeof(void*);
  22889. default: {
  22890. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  22891. return 0;
  22892. }
  22893. }
  22894. }
  22895. typedef struct { char c; short x; } __Pyx_st_short;
  22896. typedef struct { char c; int x; } __Pyx_st_int;
  22897. typedef struct { char c; long x; } __Pyx_st_long;
  22898. typedef struct { char c; float x; } __Pyx_st_float;
  22899. typedef struct { char c; double x; } __Pyx_st_double;
  22900. typedef struct { char c; long double x; } __Pyx_st_longdouble;
  22901. typedef struct { char c; void *x; } __Pyx_st_void_p;
  22902. #ifdef HAVE_LONG_LONG
  22903. typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  22904. #endif
  22905. static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
  22906. switch (ch) {
  22907. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  22908. case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
  22909. case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
  22910. case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
  22911. #ifdef HAVE_LONG_LONG
  22912. case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
  22913. #endif
  22914. case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
  22915. case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
  22916. case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
  22917. case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
  22918. default:
  22919. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  22920. return 0;
  22921. }
  22922. }
  22923. /* These are for computing the padding at the end of the struct to align
  22924. on the first member of the struct. This will probably the same as above,
  22925. but we don't have any guarantees.
  22926. */
  22927. typedef struct { short x; char c; } __Pyx_pad_short;
  22928. typedef struct { int x; char c; } __Pyx_pad_int;
  22929. typedef struct { long x; char c; } __Pyx_pad_long;
  22930. typedef struct { float x; char c; } __Pyx_pad_float;
  22931. typedef struct { double x; char c; } __Pyx_pad_double;
  22932. typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  22933. typedef struct { void *x; char c; } __Pyx_pad_void_p;
  22934. #ifdef HAVE_LONG_LONG
  22935. typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  22936. #endif
  22937. static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
  22938. switch (ch) {
  22939. case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
  22940. case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
  22941. case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
  22942. case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
  22943. #ifdef HAVE_LONG_LONG
  22944. case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
  22945. #endif
  22946. case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
  22947. case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
  22948. case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
  22949. case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
  22950. default:
  22951. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  22952. return 0;
  22953. }
  22954. }
  22955. static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  22956. switch (ch) {
  22957. case 'c':
  22958. return 'H';
  22959. case 'b': case 'h': case 'i':
  22960. case 'l': case 'q': case 's': case 'p':
  22961. return 'I';
  22962. case '?': case 'B': case 'H': case 'I': case 'L': case 'Q':
  22963. return 'U';
  22964. case 'f': case 'd': case 'g':
  22965. return (is_complex ? 'C' : 'R');
  22966. case 'O':
  22967. return 'O';
  22968. case 'P':
  22969. return 'P';
  22970. default: {
  22971. __Pyx_BufFmt_RaiseUnexpectedChar(ch);
  22972. return 0;
  22973. }
  22974. }
  22975. }
  22976. static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  22977. if (ctx->head == NULL || ctx->head->field == &ctx->root) {
  22978. const char* expected;
  22979. const char* quote;
  22980. if (ctx->head == NULL) {
  22981. expected = "end";
  22982. quote = "";
  22983. } else {
  22984. expected = ctx->head->field->type->name;
  22985. quote = "'";
  22986. }
  22987. PyErr_Format(PyExc_ValueError,
  22988. "Buffer dtype mismatch, expected %s%s%s but got %s",
  22989. quote, expected, quote,
  22990. __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
  22991. } else {
  22992. __Pyx_StructField* field = ctx->head->field;
  22993. __Pyx_StructField* parent = (ctx->head - 1)->field;
  22994. PyErr_Format(PyExc_ValueError,
  22995. "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
  22996. field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
  22997. parent->type->name, field->name);
  22998. }
  22999. }
  23000. static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  23001. char group;
  23002. size_t size, offset, arraysize = 1;
  23003. if (ctx->enc_type == 0) return 0;
  23004. if (ctx->head->field->type->arraysize[0]) {
  23005. int i, ndim = 0;
  23006. if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
  23007. ctx->is_valid_array = ctx->head->field->type->ndim == 1;
  23008. ndim = 1;
  23009. if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
  23010. PyErr_Format(PyExc_ValueError,
  23011. "Expected a dimension of size %zu, got %zu",
  23012. ctx->head->field->type->arraysize[0], ctx->enc_count);
  23013. return -1;
  23014. }
  23015. }
  23016. if (!ctx->is_valid_array) {
  23017. PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
  23018. ctx->head->field->type->ndim, ndim);
  23019. return -1;
  23020. }
  23021. for (i = 0; i < ctx->head->field->type->ndim; i++) {
  23022. arraysize *= ctx->head->field->type->arraysize[i];
  23023. }
  23024. ctx->is_valid_array = 0;
  23025. ctx->enc_count = 1;
  23026. }
  23027. group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
  23028. do {
  23029. __Pyx_StructField* field = ctx->head->field;
  23030. __Pyx_TypeInfo* type = field->type;
  23031. if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
  23032. size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
  23033. } else {
  23034. size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
  23035. }
  23036. if (ctx->enc_packmode == '@') {
  23037. size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
  23038. size_t align_mod_offset;
  23039. if (align_at == 0) return -1;
  23040. align_mod_offset = ctx->fmt_offset % align_at;
  23041. if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
  23042. if (ctx->struct_alignment == 0)
  23043. ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
  23044. ctx->is_complex);
  23045. }
  23046. if (type->size != size || type->typegroup != group) {
  23047. if (type->typegroup == 'C' && type->fields != NULL) {
  23048. size_t parent_offset = ctx->head->parent_offset + field->offset;
  23049. ++ctx->head;
  23050. ctx->head->field = type->fields;
  23051. ctx->head->parent_offset = parent_offset;
  23052. continue;
  23053. }
  23054. if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
  23055. } else {
  23056. __Pyx_BufFmt_RaiseExpected(ctx);
  23057. return -1;
  23058. }
  23059. }
  23060. offset = ctx->head->parent_offset + field->offset;
  23061. if (ctx->fmt_offset != offset) {
  23062. PyErr_Format(PyExc_ValueError,
  23063. "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
  23064. (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
  23065. return -1;
  23066. }
  23067. ctx->fmt_offset += size;
  23068. if (arraysize)
  23069. ctx->fmt_offset += (arraysize - 1) * size;
  23070. --ctx->enc_count;
  23071. while (1) {
  23072. if (field == &ctx->root) {
  23073. ctx->head = NULL;
  23074. if (ctx->enc_count != 0) {
  23075. __Pyx_BufFmt_RaiseExpected(ctx);
  23076. return -1;
  23077. }
  23078. break;
  23079. }
  23080. ctx->head->field = ++field;
  23081. if (field->type == NULL) {
  23082. --ctx->head;
  23083. field = ctx->head->field;
  23084. continue;
  23085. } else if (field->type->typegroup == 'S') {
  23086. size_t parent_offset = ctx->head->parent_offset + field->offset;
  23087. if (field->type->fields->type == NULL) continue;
  23088. field = field->type->fields;
  23089. ++ctx->head;
  23090. ctx->head->field = field;
  23091. ctx->head->parent_offset = parent_offset;
  23092. break;
  23093. } else {
  23094. break;
  23095. }
  23096. }
  23097. } while (ctx->enc_count);
  23098. ctx->enc_type = 0;
  23099. ctx->is_complex = 0;
  23100. return 0;
  23101. }
  23102. static PyObject *
  23103. __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
  23104. {
  23105. const char *ts = *tsp;
  23106. int i = 0, number;
  23107. int ndim = ctx->head->field->type->ndim;
  23108. ;
  23109. ++ts;
  23110. if (ctx->new_count != 1) {
  23111. PyErr_SetString(PyExc_ValueError,
  23112. "Cannot handle repeated arrays in format string");
  23113. return NULL;
  23114. }
  23115. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  23116. while (*ts && *ts != ')') {
  23117. switch (*ts) {
  23118. case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
  23119. default: break;
  23120. }
  23121. number = __Pyx_BufFmt_ExpectNumber(&ts);
  23122. if (number == -1) return NULL;
  23123. if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
  23124. return PyErr_Format(PyExc_ValueError,
  23125. "Expected a dimension of size %zu, got %d",
  23126. ctx->head->field->type->arraysize[i], number);
  23127. if (*ts != ',' && *ts != ')')
  23128. return PyErr_Format(PyExc_ValueError,
  23129. "Expected a comma in format string, got '%c'", *ts);
  23130. if (*ts == ',') ts++;
  23131. i++;
  23132. }
  23133. if (i != ndim)
  23134. return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
  23135. ctx->head->field->type->ndim, i);
  23136. if (!*ts) {
  23137. PyErr_SetString(PyExc_ValueError,
  23138. "Unexpected end of format string, expected ')'");
  23139. return NULL;
  23140. }
  23141. ctx->is_valid_array = 1;
  23142. ctx->new_count = 1;
  23143. *tsp = ++ts;
  23144. return Py_None;
  23145. }
  23146. static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
  23147. int got_Z = 0;
  23148. while (1) {
  23149. switch(*ts) {
  23150. case 0:
  23151. if (ctx->enc_type != 0 && ctx->head == NULL) {
  23152. __Pyx_BufFmt_RaiseExpected(ctx);
  23153. return NULL;
  23154. }
  23155. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  23156. if (ctx->head != NULL) {
  23157. __Pyx_BufFmt_RaiseExpected(ctx);
  23158. return NULL;
  23159. }
  23160. return ts;
  23161. case ' ':
  23162. case '\r':
  23163. case '\n':
  23164. ++ts;
  23165. break;
  23166. case '<':
  23167. if (!__Pyx_Is_Little_Endian()) {
  23168. PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
  23169. return NULL;
  23170. }
  23171. ctx->new_packmode = '=';
  23172. ++ts;
  23173. break;
  23174. case '>':
  23175. case '!':
  23176. if (__Pyx_Is_Little_Endian()) {
  23177. PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
  23178. return NULL;
  23179. }
  23180. ctx->new_packmode = '=';
  23181. ++ts;
  23182. break;
  23183. case '=':
  23184. case '@':
  23185. case '^':
  23186. ctx->new_packmode = *ts++;
  23187. break;
  23188. case 'T':
  23189. {
  23190. const char* ts_after_sub;
  23191. size_t i, struct_count = ctx->new_count;
  23192. size_t struct_alignment = ctx->struct_alignment;
  23193. ctx->new_count = 1;
  23194. ++ts;
  23195. if (*ts != '{') {
  23196. PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
  23197. return NULL;
  23198. }
  23199. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  23200. ctx->enc_type = 0;
  23201. ctx->enc_count = 0;
  23202. ctx->struct_alignment = 0;
  23203. ++ts;
  23204. ts_after_sub = ts;
  23205. for (i = 0; i != struct_count; ++i) {
  23206. ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
  23207. if (!ts_after_sub) return NULL;
  23208. }
  23209. ts = ts_after_sub;
  23210. if (struct_alignment) ctx->struct_alignment = struct_alignment;
  23211. }
  23212. break;
  23213. case '}':
  23214. {
  23215. size_t alignment = ctx->struct_alignment;
  23216. ++ts;
  23217. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  23218. ctx->enc_type = 0;
  23219. if (alignment && ctx->fmt_offset % alignment) {
  23220. ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
  23221. }
  23222. }
  23223. return ts;
  23224. case 'x':
  23225. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  23226. ctx->fmt_offset += ctx->new_count;
  23227. ctx->new_count = 1;
  23228. ctx->enc_count = 0;
  23229. ctx->enc_type = 0;
  23230. ctx->enc_packmode = ctx->new_packmode;
  23231. ++ts;
  23232. break;
  23233. case 'Z':
  23234. got_Z = 1;
  23235. ++ts;
  23236. if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
  23237. __Pyx_BufFmt_RaiseUnexpectedChar('Z');
  23238. return NULL;
  23239. }
  23240. CYTHON_FALLTHROUGH;
  23241. case '?': case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
  23242. case 'l': case 'L': case 'q': case 'Q':
  23243. case 'f': case 'd': case 'g':
  23244. case 'O': case 'p':
  23245. if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
  23246. ctx->enc_packmode == ctx->new_packmode) {
  23247. ctx->enc_count += ctx->new_count;
  23248. ctx->new_count = 1;
  23249. got_Z = 0;
  23250. ++ts;
  23251. break;
  23252. }
  23253. CYTHON_FALLTHROUGH;
  23254. case 's':
  23255. if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
  23256. ctx->enc_count = ctx->new_count;
  23257. ctx->enc_packmode = ctx->new_packmode;
  23258. ctx->enc_type = *ts;
  23259. ctx->is_complex = got_Z;
  23260. ++ts;
  23261. ctx->new_count = 1;
  23262. got_Z = 0;
  23263. break;
  23264. case ':':
  23265. ++ts;
  23266. while(*ts != ':') ++ts;
  23267. ++ts;
  23268. break;
  23269. case '(':
  23270. if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
  23271. break;
  23272. default:
  23273. {
  23274. int number = __Pyx_BufFmt_ExpectNumber(&ts);
  23275. if (number == -1) return NULL;
  23276. ctx->new_count = (size_t)number;
  23277. }
  23278. }
  23279. }
  23280. }
  23281. /* TypeInfoCompare */
  23282. static int
  23283. __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
  23284. {
  23285. int i;
  23286. if (!a || !b)
  23287. return 0;
  23288. if (a == b)
  23289. return 1;
  23290. if (a->size != b->size || a->typegroup != b->typegroup ||
  23291. a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
  23292. if (a->typegroup == 'H' || b->typegroup == 'H') {
  23293. return a->size == b->size;
  23294. } else {
  23295. return 0;
  23296. }
  23297. }
  23298. if (a->ndim) {
  23299. for (i = 0; i < a->ndim; i++)
  23300. if (a->arraysize[i] != b->arraysize[i])
  23301. return 0;
  23302. }
  23303. if (a->typegroup == 'S') {
  23304. if (a->flags != b->flags)
  23305. return 0;
  23306. if (a->fields || b->fields) {
  23307. if (!(a->fields && b->fields))
  23308. return 0;
  23309. for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
  23310. __Pyx_StructField *field_a = a->fields + i;
  23311. __Pyx_StructField *field_b = b->fields + i;
  23312. if (field_a->offset != field_b->offset ||
  23313. !__pyx_typeinfo_cmp(field_a->type, field_b->type))
  23314. return 0;
  23315. }
  23316. return !a->fields[i].type && !b->fields[i].type;
  23317. }
  23318. }
  23319. return 1;
  23320. }
  23321. /* MemviewSliceValidateAndInit */
  23322. static int
  23323. __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec)
  23324. {
  23325. if (buf->shape[dim] <= 1)
  23326. return 1;
  23327. if (buf->strides) {
  23328. if (spec & __Pyx_MEMVIEW_CONTIG) {
  23329. if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
  23330. if (buf->strides[dim] != sizeof(void *)) {
  23331. PyErr_Format(PyExc_ValueError,
  23332. "Buffer is not indirectly contiguous "
  23333. "in dimension %d.", dim);
  23334. goto fail;
  23335. }
  23336. } else if (buf->strides[dim] != buf->itemsize) {
  23337. PyErr_SetString(PyExc_ValueError,
  23338. "Buffer and memoryview are not contiguous "
  23339. "in the same dimension.");
  23340. goto fail;
  23341. }
  23342. }
  23343. if (spec & __Pyx_MEMVIEW_FOLLOW) {
  23344. Py_ssize_t stride = buf->strides[dim];
  23345. if (stride < 0)
  23346. stride = -stride;
  23347. if (stride < buf->itemsize) {
  23348. PyErr_SetString(PyExc_ValueError,
  23349. "Buffer and memoryview are not contiguous "
  23350. "in the same dimension.");
  23351. goto fail;
  23352. }
  23353. }
  23354. } else {
  23355. if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) {
  23356. PyErr_Format(PyExc_ValueError,
  23357. "C-contiguous buffer is not contiguous in "
  23358. "dimension %d", dim);
  23359. goto fail;
  23360. } else if (spec & (__Pyx_MEMVIEW_PTR)) {
  23361. PyErr_Format(PyExc_ValueError,
  23362. "C-contiguous buffer is not indirect in "
  23363. "dimension %d", dim);
  23364. goto fail;
  23365. } else if (buf->suboffsets) {
  23366. PyErr_SetString(PyExc_ValueError,
  23367. "Buffer exposes suboffsets but no strides");
  23368. goto fail;
  23369. }
  23370. }
  23371. return 1;
  23372. fail:
  23373. return 0;
  23374. }
  23375. static int
  23376. __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec)
  23377. {
  23378. if (spec & __Pyx_MEMVIEW_DIRECT) {
  23379. if (buf->suboffsets && buf->suboffsets[dim] >= 0) {
  23380. PyErr_Format(PyExc_ValueError,
  23381. "Buffer not compatible with direct access "
  23382. "in dimension %d.", dim);
  23383. goto fail;
  23384. }
  23385. }
  23386. if (spec & __Pyx_MEMVIEW_PTR) {
  23387. if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) {
  23388. PyErr_Format(PyExc_ValueError,
  23389. "Buffer is not indirectly accessible "
  23390. "in dimension %d.", dim);
  23391. goto fail;
  23392. }
  23393. }
  23394. return 1;
  23395. fail:
  23396. return 0;
  23397. }
  23398. static int
  23399. __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag)
  23400. {
  23401. int i;
  23402. if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
  23403. Py_ssize_t stride = 1;
  23404. for (i = 0; i < ndim; i++) {
  23405. if (stride * buf->itemsize != buf->strides[i] &&
  23406. buf->shape[i] > 1)
  23407. {
  23408. PyErr_SetString(PyExc_ValueError,
  23409. "Buffer not fortran contiguous.");
  23410. goto fail;
  23411. }
  23412. stride = stride * buf->shape[i];
  23413. }
  23414. } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
  23415. Py_ssize_t stride = 1;
  23416. for (i = ndim - 1; i >- 1; i--) {
  23417. if (stride * buf->itemsize != buf->strides[i] &&
  23418. buf->shape[i] > 1) {
  23419. PyErr_SetString(PyExc_ValueError,
  23420. "Buffer not C contiguous.");
  23421. goto fail;
  23422. }
  23423. stride = stride * buf->shape[i];
  23424. }
  23425. }
  23426. return 1;
  23427. fail:
  23428. return 0;
  23429. }
  23430. static int __Pyx_ValidateAndInit_memviewslice(
  23431. int *axes_specs,
  23432. int c_or_f_flag,
  23433. int buf_flags,
  23434. int ndim,
  23435. __Pyx_TypeInfo *dtype,
  23436. __Pyx_BufFmt_StackElem stack[],
  23437. __Pyx_memviewslice *memviewslice,
  23438. PyObject *original_obj)
  23439. {
  23440. struct __pyx_memoryview_obj *memview, *new_memview;
  23441. __Pyx_RefNannyDeclarations
  23442. Py_buffer *buf;
  23443. int i, spec = 0, retval = -1;
  23444. __Pyx_BufFmt_Context ctx;
  23445. int from_memoryview = __pyx_memoryview_check(original_obj);
  23446. __Pyx_RefNannySetupContext("ValidateAndInit_memviewslice", 0);
  23447. if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((struct __pyx_memoryview_obj *)
  23448. original_obj)->typeinfo)) {
  23449. memview = (struct __pyx_memoryview_obj *) original_obj;
  23450. new_memview = NULL;
  23451. } else {
  23452. memview = (struct __pyx_memoryview_obj *) __pyx_memoryview_new(
  23453. original_obj, buf_flags, 0, dtype);
  23454. new_memview = memview;
  23455. if (unlikely(!memview))
  23456. goto fail;
  23457. }
  23458. buf = &memview->view;
  23459. if (buf->ndim != ndim) {
  23460. PyErr_Format(PyExc_ValueError,
  23461. "Buffer has wrong number of dimensions (expected %d, got %d)",
  23462. ndim, buf->ndim);
  23463. goto fail;
  23464. }
  23465. if (new_memview) {
  23466. __Pyx_BufFmt_Init(&ctx, stack, dtype);
  23467. if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
  23468. }
  23469. if ((unsigned) buf->itemsize != dtype->size) {
  23470. PyErr_Format(PyExc_ValueError,
  23471. "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) "
  23472. "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)",
  23473. buf->itemsize,
  23474. (buf->itemsize > 1) ? "s" : "",
  23475. dtype->name,
  23476. dtype->size,
  23477. (dtype->size > 1) ? "s" : "");
  23478. goto fail;
  23479. }
  23480. for (i = 0; i < ndim; i++) {
  23481. spec = axes_specs[i];
  23482. if (!__pyx_check_strides(buf, i, ndim, spec))
  23483. goto fail;
  23484. if (!__pyx_check_suboffsets(buf, i, ndim, spec))
  23485. goto fail;
  23486. }
  23487. if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))
  23488. goto fail;
  23489. if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
  23490. new_memview != NULL) == -1)) {
  23491. goto fail;
  23492. }
  23493. retval = 0;
  23494. goto no_fail;
  23495. fail:
  23496. Py_XDECREF(new_memview);
  23497. retval = -1;
  23498. no_fail:
  23499. __Pyx_RefNannyFinishContext();
  23500. return retval;
  23501. }
  23502. /* ObjectToMemviewSlice */
  23503. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_int(PyObject *obj, int writable_flag) {
  23504. __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
  23505. __Pyx_BufFmt_StackElem stack[1];
  23506. int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
  23507. int retcode;
  23508. if (obj == Py_None) {
  23509. result.memview = (struct __pyx_memoryview_obj *) Py_None;
  23510. return result;
  23511. }
  23512. retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
  23513. PyBUF_RECORDS_RO | writable_flag, 2,
  23514. &__Pyx_TypeInfo_int, stack,
  23515. &result, obj);
  23516. if (unlikely(retcode == -1))
  23517. goto __pyx_fail;
  23518. return result;
  23519. __pyx_fail:
  23520. result.memview = NULL;
  23521. result.data = NULL;
  23522. return result;
  23523. }
  23524. /* ObjectToMemviewSlice */
  23525. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_char(PyObject *obj, int writable_flag) {
  23526. __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
  23527. __Pyx_BufFmt_StackElem stack[1];
  23528. int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
  23529. int retcode;
  23530. if (obj == Py_None) {
  23531. result.memview = (struct __pyx_memoryview_obj *) Py_None;
  23532. return result;
  23533. }
  23534. retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
  23535. PyBUF_RECORDS_RO | writable_flag, 2,
  23536. &__Pyx_TypeInfo_char, stack,
  23537. &result, obj);
  23538. if (unlikely(retcode == -1))
  23539. goto __pyx_fail;
  23540. return result;
  23541. __pyx_fail:
  23542. result.memview = NULL;
  23543. result.data = NULL;
  23544. return result;
  23545. }
  23546. /* ObjectToMemviewSlice */
  23547. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float__const__(PyObject *obj, int writable_flag) {
  23548. __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
  23549. __Pyx_BufFmt_StackElem stack[1];
  23550. int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
  23551. int retcode;
  23552. if (obj == Py_None) {
  23553. result.memview = (struct __pyx_memoryview_obj *) Py_None;
  23554. return result;
  23555. }
  23556. retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
  23557. PyBUF_RECORDS_RO | writable_flag, 2,
  23558. &__Pyx_TypeInfo_float__const__, stack,
  23559. &result, obj);
  23560. if (unlikely(retcode == -1))
  23561. goto __pyx_fail;
  23562. return result;
  23563. __pyx_fail:
  23564. result.memview = NULL;
  23565. result.data = NULL;
  23566. return result;
  23567. }
  23568. /* ObjectToMemviewSlice */
  23569. static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dsds_float(PyObject *obj, int writable_flag) {
  23570. __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
  23571. __Pyx_BufFmt_StackElem stack[1];
  23572. int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
  23573. int retcode;
  23574. if (obj == Py_None) {
  23575. result.memview = (struct __pyx_memoryview_obj *) Py_None;
  23576. return result;
  23577. }
  23578. retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
  23579. PyBUF_RECORDS_RO | writable_flag, 2,
  23580. &__Pyx_TypeInfo_float, stack,
  23581. &result, obj);
  23582. if (unlikely(retcode == -1))
  23583. goto __pyx_fail;
  23584. return result;
  23585. __pyx_fail:
  23586. result.memview = NULL;
  23587. result.data = NULL;
  23588. return result;
  23589. }
  23590. /* CheckBinaryVersion */
  23591. static int __Pyx_check_binary_version(void) {
  23592. char ctversion[4], rtversion[4];
  23593. PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
  23594. PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
  23595. if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
  23596. char message[200];
  23597. PyOS_snprintf(message, sizeof(message),
  23598. "compiletime version %s of module '%.100s' "
  23599. "does not match runtime version %s",
  23600. ctversion, __Pyx_MODULE_NAME, rtversion);
  23601. return PyErr_WarnEx(NULL, message, 1);
  23602. }
  23603. return 0;
  23604. }
  23605. /* InitStrings */
  23606. static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  23607. while (t->p) {
  23608. #if PY_MAJOR_VERSION < 3
  23609. if (t->is_unicode) {
  23610. *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
  23611. } else if (t->intern) {
  23612. *t->p = PyString_InternFromString(t->s);
  23613. } else {
  23614. *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
  23615. }
  23616. #else
  23617. if (t->is_unicode | t->is_str) {
  23618. if (t->intern) {
  23619. *t->p = PyUnicode_InternFromString(t->s);
  23620. } else if (t->encoding) {
  23621. *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
  23622. } else {
  23623. *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
  23624. }
  23625. } else {
  23626. *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
  23627. }
  23628. #endif
  23629. if (!*t->p)
  23630. return -1;
  23631. if (PyObject_Hash(*t->p) == -1)
  23632. return -1;
  23633. ++t;
  23634. }
  23635. return 0;
  23636. }
  23637. static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
  23638. return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
  23639. }
  23640. static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  23641. Py_ssize_t ignore;
  23642. return __Pyx_PyObject_AsStringAndSize(o, &ignore);
  23643. }
  23644. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  23645. #if !CYTHON_PEP393_ENABLED
  23646. static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  23647. char* defenc_c;
  23648. PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
  23649. if (!defenc) return NULL;
  23650. defenc_c = PyBytes_AS_STRING(defenc);
  23651. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  23652. {
  23653. char* end = defenc_c + PyBytes_GET_SIZE(defenc);
  23654. char* c;
  23655. for (c = defenc_c; c < end; c++) {
  23656. if ((unsigned char) (*c) >= 128) {
  23657. PyUnicode_AsASCIIString(o);
  23658. return NULL;
  23659. }
  23660. }
  23661. }
  23662. #endif
  23663. *length = PyBytes_GET_SIZE(defenc);
  23664. return defenc_c;
  23665. }
  23666. #else
  23667. static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  23668. if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
  23669. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  23670. if (likely(PyUnicode_IS_ASCII(o))) {
  23671. *length = PyUnicode_GET_LENGTH(o);
  23672. return PyUnicode_AsUTF8(o);
  23673. } else {
  23674. PyUnicode_AsASCIIString(o);
  23675. return NULL;
  23676. }
  23677. #else
  23678. return PyUnicode_AsUTF8AndSize(o, length);
  23679. #endif
  23680. }
  23681. #endif
  23682. #endif
  23683. static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
  23684. #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
  23685. if (
  23686. #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
  23687. __Pyx_sys_getdefaultencoding_not_ascii &&
  23688. #endif
  23689. PyUnicode_Check(o)) {
  23690. return __Pyx_PyUnicode_AsStringAndSize(o, length);
  23691. } else
  23692. #endif
  23693. #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
  23694. if (PyByteArray_Check(o)) {
  23695. *length = PyByteArray_GET_SIZE(o);
  23696. return PyByteArray_AS_STRING(o);
  23697. } else
  23698. #endif
  23699. {
  23700. char* result;
  23701. int r = PyBytes_AsStringAndSize(o, &result, length);
  23702. if (unlikely(r < 0)) {
  23703. return NULL;
  23704. } else {
  23705. return result;
  23706. }
  23707. }
  23708. }
  23709. static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  23710. int is_true = x == Py_True;
  23711. if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
  23712. else return PyObject_IsTrue(x);
  23713. }
  23714. static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  23715. int retval;
  23716. if (unlikely(!x)) return -1;
  23717. retval = __Pyx_PyObject_IsTrue(x);
  23718. Py_DECREF(x);
  23719. return retval;
  23720. }
  23721. static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
  23722. #if PY_MAJOR_VERSION >= 3
  23723. if (PyLong_Check(result)) {
  23724. if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
  23725. "__int__ returned non-int (type %.200s). "
  23726. "The ability to return an instance of a strict subclass of int "
  23727. "is deprecated, and may be removed in a future version of Python.",
  23728. Py_TYPE(result)->tp_name)) {
  23729. Py_DECREF(result);
  23730. return NULL;
  23731. }
  23732. return result;
  23733. }
  23734. #endif
  23735. PyErr_Format(PyExc_TypeError,
  23736. "__%.4s__ returned non-%.4s (type %.200s)",
  23737. type_name, type_name, Py_TYPE(result)->tp_name);
  23738. Py_DECREF(result);
  23739. return NULL;
  23740. }
  23741. static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
  23742. #if CYTHON_USE_TYPE_SLOTS
  23743. PyNumberMethods *m;
  23744. #endif
  23745. const char *name = NULL;
  23746. PyObject *res = NULL;
  23747. #if PY_MAJOR_VERSION < 3
  23748. if (likely(PyInt_Check(x) || PyLong_Check(x)))
  23749. #else
  23750. if (likely(PyLong_Check(x)))
  23751. #endif
  23752. return __Pyx_NewRef(x);
  23753. #if CYTHON_USE_TYPE_SLOTS
  23754. m = Py_TYPE(x)->tp_as_number;
  23755. #if PY_MAJOR_VERSION < 3
  23756. if (m && m->nb_int) {
  23757. name = "int";
  23758. res = m->nb_int(x);
  23759. }
  23760. else if (m && m->nb_long) {
  23761. name = "long";
  23762. res = m->nb_long(x);
  23763. }
  23764. #else
  23765. if (likely(m && m->nb_int)) {
  23766. name = "int";
  23767. res = m->nb_int(x);
  23768. }
  23769. #endif
  23770. #else
  23771. if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
  23772. res = PyNumber_Int(x);
  23773. }
  23774. #endif
  23775. if (likely(res)) {
  23776. #if PY_MAJOR_VERSION < 3
  23777. if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
  23778. #else
  23779. if (unlikely(!PyLong_CheckExact(res))) {
  23780. #endif
  23781. return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
  23782. }
  23783. }
  23784. else if (!PyErr_Occurred()) {
  23785. PyErr_SetString(PyExc_TypeError,
  23786. "an integer is required");
  23787. }
  23788. return res;
  23789. }
  23790. static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  23791. Py_ssize_t ival;
  23792. PyObject *x;
  23793. #if PY_MAJOR_VERSION < 3
  23794. if (likely(PyInt_CheckExact(b))) {
  23795. if (sizeof(Py_ssize_t) >= sizeof(long))
  23796. return PyInt_AS_LONG(b);
  23797. else
  23798. return PyInt_AsSsize_t(b);
  23799. }
  23800. #endif
  23801. if (likely(PyLong_CheckExact(b))) {
  23802. #if CYTHON_USE_PYLONG_INTERNALS
  23803. const digit* digits = ((PyLongObject*)b)->ob_digit;
  23804. const Py_ssize_t size = Py_SIZE(b);
  23805. if (likely(__Pyx_sst_abs(size) <= 1)) {
  23806. ival = likely(size) ? digits[0] : 0;
  23807. if (size == -1) ival = -ival;
  23808. return ival;
  23809. } else {
  23810. switch (size) {
  23811. case 2:
  23812. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  23813. return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  23814. }
  23815. break;
  23816. case -2:
  23817. if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
  23818. return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  23819. }
  23820. break;
  23821. case 3:
  23822. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  23823. return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  23824. }
  23825. break;
  23826. case -3:
  23827. if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
  23828. return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
  23829. }
  23830. break;
  23831. case 4:
  23832. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  23833. 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]));
  23834. }
  23835. break;
  23836. case -4:
  23837. if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
  23838. 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]));
  23839. }
  23840. break;
  23841. }
  23842. }
  23843. #endif
  23844. return PyLong_AsSsize_t(b);
  23845. }
  23846. x = PyNumber_Index(b);
  23847. if (!x) return -1;
  23848. ival = PyInt_AsSsize_t(x);
  23849. Py_DECREF(x);
  23850. return ival;
  23851. }
  23852. static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  23853. return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
  23854. }
  23855. static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
  23856. return PyInt_FromSize_t(ival);
  23857. }
  23858. #endif /* Py_PYTHON_H */