diff options
98 files changed, 1947 insertions, 1079 deletions
diff --git a/.gitmodules b/.gitmodules index e69de29bb..0d6857868 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "doc/source/_static/scipy-mathjax"] + path = doc/source/_static/scipy-mathjax + url = https://github.com/scipy/scipy-mathjax.git @@ -8,301 +8,422 @@ # This file is up-to-date if the command git log --format="%aN <%aE>" | sort -u # gives no duplicates. -Aaron Baecker <abaecker@localhost> abaecker <abaecker@localhost> -Aarthi Agurusa <agurusa@gmail.com> agurusa <agurusa@gmail.com> -Alan Fontenot <logeaux@yahoo.com> logeaux <logeaux@yahoo.com> -Alan Fontenot <logeaux@yahoo.com> logeaux <36168460+logeaux@users.noreply.github.com> -Abdul Muneer <abdulmuneer@gmail.com> abdulmuneer <abdulmuneer@gmail.com> -Abhilash Barigidad <abhilash.ub@gmail.com> abhilash42 <64172584+abhilash42@users.noreply.github.com> -Abhinav Reddy <abhinav071197@gmail.com> tabhi0797 <abhinav071197@gmail.com> -Adam Ginsburg <adam.g.ginsburg@gmail.com> Adam Ginsburg <keflavich@gmail.com> -Albert Jornet Puig <albert.jornet@ic3.cat> jurnix <albert.jornet@ic3.cat> -Alex Rockhill <aprockhill206@gmail.com> Alex <aprockhill206@gmail.com> -Alex Griffing <argriffi@ncsu.edu> alex <argriffi@ncsu.edu> -Alex Griffing <argriffi@ncsu.edu> argriffing <argriffi@ncsu.edu> -Alex Griffing <argriffi@ncsu.edu> argriffing <argriffing@gmail.com> -Alex Griffing <argriffi@ncsu.edu> argriffing <argriffing@users.noreply.github.com> -Alex Thomas <alexthomas93@users.noreply.github.com> alexthomas93 <alexthomas93@users.noreply.github.com> -Alexander Belopolsky <abalkin@enlnt.com> Alexander Belopolsky <a@enlnt.com> -Alexander Belopolsky <abalkin@enlnt.com> Alexander Belopolsky <a@enlnt.com> +Aaron Baecker <abaecker@localhost> +Aarthi Agurusa <agurusa@gmail.com> +Alan Fontenot <logeaux@yahoo.com> +Alan Fontenot <logeaux@yahoo.com> <36168460+logeaux@users.noreply.github.com> +Abdul Muneer <abdulmuneer@gmail.com> +Abhilash Barigidad <abhilash.ub@gmail.com> +Abhilash Barigidad <abhilash.ub@gmail.com> <64172584+abhilash42@users.noreply.github.com> +Abhinav Reddy <abhinav071197@gmail.com> +Adam Ginsburg <adam.g.ginsburg@gmail.com> <keflavich@gmail.com> +Aerik Pawson <45904740+aerikpawson@users.noreply.github.com> +Albert Jornet Puig <albert.jornet@ic3.cat> +Alex Rockhill <aprockhill206@gmail.com> +Alex Griffing <argriffi@ncsu.edu> +Alex Griffing <argriffi@ncsu.edu> <argriffing@gmail.com> +Alex Griffing <argriffi@ncsu.edu> <argriffing@users.noreply.github.com> +Alex Henrie <alexhenrie24@gmail.com> <alex.henrie@utah.edu> +Alex Rogozhnikov <iamfullofspam@gmail.com> <arogozhnikov@users.noreply.github.com> +Alex Thomas <alexthomas93@users.noreply.github.com> +Alexander Belopolsky <abalkin@enlnt.com> +Alexander Belopolsky <abalkin@enlnt.com> <a@enlnt.com> +Alexander Belopolsky <abalkin@enlnt.com> <abalkin@users.noreply.github.com> Alexander Belopolsky <abalkin@enlnt.com> sasha <sasha@localhost> -Alexander Jung <kontakt@ajung.name> aleju <kontakt@ajung.name> -Alexander Shadchin <alexandr.shadchin@gmail.com> Alexandr Shadchin <alexandr.shadchin@gmail.com> -Alexander Shadchin <alexandr.shadchin@gmail.com> shadchin <alexandr.shadchin@gmail.com> -Allan Haldane <allan.haldane@gmail.com> ahaldane <ealloc@gmail.com> +Alexander Hunt <alexander.l.hunt951@gmail.com> +Alexander Jung <kontakt@ajung.name> +Alexander Shadchin <alexandr.shadchin@gmail.com> +Alexander Shadchin <alexandr.shadchin@gmail.com> <shadchin@yandex-team.ru> +Alizé Papp <68250865+alize-papp@users.noreply.github.com> +Allan Haldane <allan.haldane@gmail.com> <ealloc@gmail.com> +Al-Baraa El-Hag <a.elhag01@gmail.com> <48454648+a-elhag@users.noreply.github.com> Alok Singhal <gandalf013@gmail.com> Alok Singhal <alok@merfinllc.com> -Alyssa Quek <alyssaquek@gmail.com> alyssaq <alyssaquek@gmail.com> -Amir Sarabadani <ladsgroup@gmail.com> amir <ladsgroup@gmail.com> -Anatoly Techtonik <techtonik@gmail.com> anatoly techtonik <techtonik@gmail.com> -Andras Deak <deak.andris@gmail.com> adeak <adeak@users.noreply.github.com> -Andrea Olivo andryandrew@gmail.com andryandrew <andryandrew@gmail.com> -Andrea Pattori <andrea.pattori@gmail.com> patto90 <andrea.pattori@gmail.com> -Andrea Sangalli <and-sang@outlook.com> and-sang <53617841+and-sang@users.noreply.github.com> -Andrei Kucharavy <ank@andreikucharavy.com> chiffa <ank@andreikucharavy.com> -Anne Archibald <peridot.faceted@gmail.com> aarchiba <peridot.faceted@gmail.com> -Anne Archibald <peridot.faceted@gmail.com> Anne Archibald <archibald@astron.nl> -Anže Starič <anze.staric@gmail.com> astaric <anze.staric@gmail.com> -Aron Ahmadia <aron@ahmadia.net> ahmadia <aron@ahmadia.net> -Arun Persaud <apersaud@lbl.gov> Arun Persaud <arun@nubati.net> -Ashutosh Singh <ashutoshsinghrkt@gmail.com> ashutosh619-sudo <ashutoshsinghrkt@gmail.com> -Ashutosh Singh <ashutoshsinghrkt@gmail.com> Ashutosh singh <55102089+Ashutosh619-sudo@users.noreply.github.com> -Åsmund Hjulstad <ahju@statoil.com> Åsmund Hjulstad <asmund@hjulstad.com> -Auke Wiggers <wiggers.auke@gmail.com> auke <wiggers.auke@gmail.com> -Badhri Narayanan Krishnakumar <badhrinarayanan.k@gmail.com> badhrink <badhrinarayanan.k@gmail.com> -Bangcheng Yang <bangchengyang@hotmail.com> DumbMice <bangchengyang@hotmail.com> -Behzad Nouri <behzadnouri@gmail.com> behzad nouri <behzadnouri@gmail.com> -Ben Nathanson <github@bigriver.xyz> bjnath <github@bigriver.xyz> -Benjamin Root <ben.v.root@gmail.com> Ben Root <ben.v.root@gmail.com> +Alyssa Quek <alyssaquek@gmail.com> +Amir Sarabadani <ladsgroup@gmail.com> +Anas Khan <anasalimkhan@gmail.com> <anas.khan96@outlook.com> +Anatoly Techtonik <techtonik@gmail.com> +Andras Deak <deak.andris@gmail.com> <adeak@users.noreply.github.com> +Andrea Olivo <andryandrew@gmail.com> +Andrea Pattori <andrea.pattori@gmail.com> +Andrea Sangalli <and-sang@outlook.com> <53617841+and-sang@users.noreply.github.com> +Andreas Klöckner <inform@tiker.net> +Andreas Schwab <schwab@suse.de> <schwab@linux-m68k.org> +Andrei Kucharavy <ank@andreikucharavy.com> +Andrew Lawson <andrew.lawson@nag.co.uk> <andrewl@olney.nag.co.uk> +Anirudh Subramanian <anirudh2290@ufl.edu> +Anne Archibald <peridot.faceted@gmail.com> +Anne Archibald <peridot.faceted@gmail.com> <archibald@astron.nl> +Anne Bonner <bonn0062@yahoo.com> <35413198+bonn0062@users.noreply.github.com> +Anthony Vo <anthonyhvo12@gmail.com> <43098273+anthonyhvo12@users.noreply.github.com> +Antoine Pitrou <antoine@python.org> <pitrou@free.fr> +Anže Starič <anze.staric@gmail.com> +Aron Ahmadia <aron@ahmadia.net> +Arun Persaud <apersaud@lbl.gov> <arun@nubati.net> +Ashutosh Singh <ashutoshsinghrkt@gmail.com> +Ashutosh Singh <ashutoshsinghrkt@gmail.com> <55102089+Ashutosh619-sudo@users.noreply.github.com> +Åsmund Hjulstad <ahju@statoil.com> <asmund@hjulstad.com> +Auke Wiggers <wiggers.auke@gmail.com> +Badhri Narayanan Krishnakumar <badhrinarayanan.k@gmail.com> +Bangcheng Yang <bangchengyang@hotmail.com> +Bas van Beek <b.f.van.beek@vu.nl> <43369155+BvB93@users.noreply.github.com> +Behzad Nouri <behzadnouri@gmail.com> +Ben Nathanson <github@bigriver.xyz> +Benjamin Root <ben.v.root@gmail.com> Benjamin Root <ben.v.root@gmail.com> weathergod <?@?> -Bernardt Duvenhage <bernardt.duvenhage@gmail.com> bduvenhage <bernardt.duvenhage@gmail.com> -Bernie Gray <bfgray3@users.noreply.github.com> bernie gray <bfgray3@users.noreply.github.com> -Bertrand Lefebvre <bertrand.l3f@gmail.com> bertrand <bertrand.l3f@gmail.com> -Bertrand Lefebvre <bertrand.l3f@gmail.com> Bertrand <bertrand.l3f@gmail.com> -Bharat Raghunathan <bharatr@symphonyai.com> Bharat123Rox <bharatr@symphonyai.com> -Bill Spotz <wfspotz@sandia.gov> William Spotz <wfspotz@sandia.gov@localhost> -Bill Spotz <wfspotz@sandia.gov> wfspotz@sandia.gov <wfspotz@sandia.gov@localhost> -Bob Eldering <eldering@jive.eu> bobeldering <eldering@jive.eu> -Brett R Murphy <bmurphy@enthought.com> brettrmurphy <bmurphy@enthought.com> +Bernardt Duvenhage <bernardt.duvenhage@gmail.com> +Bernie Gray <bfgray3@users.noreply.github.com> +Bertrand Lefebvre <bertrand.l3f@gmail.com> +Bharat Raghunathan <bharatraghunthan9767@gmail.com> +Bharat Raghunathan <bharatraghunthan9767@gmail.com> <bharatr@symphonyai.com> +Bob Eldering <eldering@jive.eu> +Brett R Murphy <bmurphy@enthought.com> +Brigitta Sipocz <bsipocz@gmail.com> <b.sipocz@gmail.com> +Brian Soto <iambriansoto@gmail.com> +Brian Soto <iambriansoto@gmail.com> <theintrocode@gmail.com> +Brian Soto <iambriansoto@gmail.com> <Iamsoto@users.noreply.github.com> Bryan Van de Ven <bryanv@continuum.io> Bryan Van de Ven <bryan@Laptop-3.local> Bryan Van de Ven <bryanv@continuum.io> Bryan Van de Ven <bryan@laptop.local> -Bui Duc Minh <buiducminh287@gmail.com> Mibu287 <41239569+Mibu287@users.noreply.github.com> -Carl Kleffner <cmkleffner@gmail.com> carlkl <cmkleffner@gmail.com> -Carl Leake <leakec57@gmail.com> leakec <leakec57@gmail.com> -Chris Burns <chris.burns@localhost> chris.burns <chris.burns@localhost> -Chris Kerr <debdepba@dasganma.tk> Chris Kerr <cjk34@cam.ac.uk> -Christian Clauss <cclauss@bluewin.ch> cclauss <cclauss@bluewin.ch> -Christopher Hanley <chanley@gmail.com> chanley <chanley@gmail.com> +Bui Duc Minh <buiducminh287@gmail.com> <41239569+Mibu287@users.noreply.github.com> +Carl Kleffner <cmkleffner@gmail.com> +Carl Leake <leakec57@gmail.com> +Charles Stern <62192187+cisaacstern@users.noreply.github.com> +Chris Barker <Chris.Barker@noaa.gov> <chris.barker@local> +Chris Burns <chris.burns@localhost> +Chris Holland <chrisholland3553@gmail.com> <41524756+ChrisAHolland@users.noreply.github.com> +Chris Kerr <debdepba@dasganma.tk> <cjk34@cam.ac.uk> +Chris Vavaliaris <cv1038@wildcats.unh.edu> +Christian Clauss <cclauss@bluewin.ch> +Christopher Dahlin <christopher@dahlin.tech> <christopher@tracsense.tech> +Christopher Hanley <chanley@gmail.com> +Christoph Gohlke <cgohlke@uci.edu> +Christoph Gohlke <cgohlke@uci.edu> <cjgohlke@gmail.com> Christoph Gohlke <cgohlke@uci.edu> cgholke <?@?> -Christoph Gohlke <cgohlke@uci.edu> cgohlke <cgohlke@uci.edu> -Christoph Gohlke <cgohlke@uci.edu> Christolph Gohlke <cgohlke@uci.edu> -Chunlin Fang <fangchunlin@huawei.com> Qiyu8 <fangchunlin@huawei.com> -Chunlin Fang <fangchunlin@huawei.com> qiyu8 <fangchunlin@huawei.com> -Chunlin Fang <fangchunlin@huawei.com> qiyu8 <qiyu8@foxmail.com> -Chunlin Fang <fangchunlin@huawei.com> Chunlin <fangchunlin@huawei.com> -Colin Snyder <47012605+colinsnyder@users.noreply.github.com> colinsnyder <47012605+colinsnyder@users.noreply.github.com> -Daniel B Allan <daniel.b.allan@gmail.com> danielballan <daniel.b.allan@gmail.com> -Daniel da Silva <mail@danieldasilva.org> Daniel da Silva <daniel@meltingwax.net> -Daniel da Silva <mail@danieldasilva.org> Daniel da Silva <var.mail.daniel@gmail.com> -Daniel Hrisca <daniel.hrisca@gmail.com> danielhrisca <daniel.hrisca@gmail.com> -Daniel J Farrell <danieljfarrel@me.com> danieljfarrell <danieljfarrel@me.com> -Daniel Montes <53720019+Aerysv@users.noreply.github.com> Aerysv <53720019+Aerysv@users.noreply.github.com> +Chunlin Fang <fangchunlin@huawei.com> +Chunlin Fang <fangchunlin@huawei.com> <qiyu8@foxmail.com> +Chunlin Fang <fangchunlin@huawei.com> <834352945@qq.com> +Colin Snyder <8csnyder@gmail.com> <47012605+colinsnyder@users.noreply.github.com> +Constanza Fierro <constanza.fierro94@gmail.com> +Daniel B Allan <daniel.b.allan@gmail.com> +Daniel da Silva <mail@danieldasilva.org> <daniel@meltingwax.net> +Daniel da Silva <mail@danieldasilva.org> <var.mail.daniel@gmail.com> +Daniel Hrisca <daniel.hrisca@gmail.com> +Daniel J Farrell <danieljfarrel@me.com> +Daniel Montes <53720019+Aerysv@users.noreply.github.com> +Daniel Müllner <Daniel Müllner muellner@math.stanford.edu> Daniel Müllner <Daniel Müllner muellner@math.stanford.edu> Daniel <muellner@localhost.localdomain> -Daniel Müllner <Daniel Müllner muellner@math.stanford.edu> dmuellner <Daniel Müllner muellner@math.stanford.edu> -Daniel Rasmussen <daniel.rasmussen@appliedbrainresearch.com> drasmuss <daniel.rasmussen@appliedbrainresearch.com> +Daniel Rasmussen <daniel.rasmussen@appliedbrainresearch.com> +Daniel G. A. Smith <dgasmith@icloud.com> +Daniel G. A. Smith <dgasmith@icloud.com> <malorian@me.com> +Dario Mory <daaawx@gmail.com> David Huard <david.huard@gmail.com> dhuard <dhuard@localhost> -David M Cooke <cookedm@localhost> cookedm <cookedm@localhost> -David Nicholson <davidjn@google.com> davidjn <dnic12345@gmail.com> -David Ochoa <ochoadavid@gmail.com> ochoadavid <ochoadavid@gmail.com> -Davide Dal Bosco <davidemcwood@gmail.com> davidedalbosco <62077652+davidedalbosco@users.noreply.github.com> -Dawid Zych <dawid.zych@yandex.com> silenc3r <dawid.zych@yandex.com> -Dennis Zollo <dzollo@swift-nav.com> denniszollo <dzollo@swift-nav.com> -Derek Homeier <derek@astro.physik.uni-goettingen.de> Derek Homeier <dhomeie@gwdg.de> -Derek Homeier <derek@astro.physik.uni-goettingen.de> Derek Homeir <derek@astro.phsik.uni-goettingen.de> -Derek Homeier <derek@astro.physik.uni-goettingen.de> Derek Homier <derek@astro.physik.uni-goettingen.de> -Derrick Williams <myutat@gmail.com> derrick <myutat@gmail.com> -Dmitriy Shalyga <zuko3d@gmail.com> zuko3d <zuko3d@gmail.com> -Dustan Levenstein <dlevenstein@gmail.com> dustanlevenstein <43019642+dustanlevenstein@users.noreply.github.com> -Ed Schofield <edschofield@localhost> edschofield <edschofield@localhost> -Egor Zindy <ezindy@gmail.com> zindy <ezindy@gmail.com> +David M Cooke <cookedm@localhost> +David Nicholson <davidjn@google.com> <dnic12345@gmail.com> +David Ochoa <ochoadavid@gmail.com> +David Pitchford <david.t.pitchford@gmail.com> <david.t.pitchford@gmail.com> +Davide Dal Bosco <davidemcwood@gmail.com> <62077652+davidedalbosco@users.noreply.github.com> +Dawid Zych <dawid.zych@yandex.com> +Dennis Zollo <dzollo@swift-nav.com> +Derek Homeier <derek@astro.physik.uni-goettingen.de> +Derek Homeier <derek@astro.physik.uni-goettingen.de> <dhomeie@gwdg.de> +Derek Homeier <derek@astro.physik.uni-goettingen.de> <derek@astro.phsik.uni-goettingen.de> +Derrick Williams <myutat@gmail.com> +Dmitriy Shalyga <zuko3d@gmail.com> +Dustan Levenstein <dlevenstein@gmail.com> <43019642+dustanlevenstein@users.noreply.github.com> +Dylan Cutler <dylancutler@google.com> +Ed Schofield <edschofield@localhost> +Egor Zindy <ezindy@gmail.com> +Elliott M. Forney <elliott.forney@gmail.com> Endolith <endolith@gmail.com> -Erik M. Bray <erik.bray@lri.fr> E. M. Bray <erik.bray@lri.fr> -Erik M. Bray <erik.bray@lri.fr> Erik Bray <erik.m.bray@gmail.com> +Erik M. Bray <erik.m.bray@gmail.com> +Erik M. Bray <erik.m.bray@gmail.com> <erik.bray@lri.fr> +Erik M. Bray <erik.m.bray@gmail.com> <embray@stsci.edu> Eric Fode <ericfode@gmail.com> Eric Fode <ericfode@linuxlaptop.(none)> -Eric Quintero <eric.antonio.quintero@gmail.com> e-q <eric.antonio.quintero@gmail.com> -Ernest N. Mamikonyan <ernest.mamikonyan@gmail.com> mamikony <ernest.mamikonyan@sig.com> -Etienne Guesnet <etienne.guesnet.external@atos.net> EGuesnet <51407514+EGuesnet@users.noreply.github.com> +Eric Quintero <eric.antonio.quintero@gmail.com> +Ernest N. Mamikonyan <ernest.mamikonyan@gmail.com> +Etienne Guesnet <etienne.guesnet.external@atos.net> <51407514+EGuesnet@users.noreply.github.com> +Eva Jau <evaj@posteo.de> Evgeni Burovski <evgeny.burovskiy@gmail.com> Evgeni Burovski <evgeni@burovski.me> -Evgeny Toder <evgeny.toder@jpmorgan.com> eltjpm <evgeny.toder@jpmorgan.com> -Fernando Perez <Fernando.Perez@berkeley.edu> Fernando Perez <fperez@fperez.org> +Evgeny Toder <evgeny.toder@jpmorgan.com> +Fernando Perez <Fernando.Perez@berkeley.edu> <fperez@fperez.org> +Filip Trojan <f.trojan@centrum.cz> <Tarantula2018> +François Le Lay <mfworx@gmail.com> <fly@spotify.com> +Frank Breitling <frank.breitling@gmx.de> Friedrich Dunne <dunneff@tcd.ie> dunneff <dunneff@tcd.ie> Frederic Bastien <nouiz@nouiz.org> Frederic <nouiz@nouiz.org> -Gael Varoquaux <gael.varoquaux@normalesup.org> GaelVaroquaux <gael.varoquaux@normalesup.org> -Gerrit Holl <gerrit.holl@utoronto.ca> Gerrit Holl <g.holl@reading.ac.uk> -Giuseppe Venturini <ggventurini@users.noreply.github.com> ggventurini <ggventurini@users.noreply.github.com> -Golnaz Irannejad <golnazirannejad@gmail.com> golnazir <golnazirannejad@gmail.com> -Gopal Singh Meena <gopalmeena94@gmail.com> gopalmeena <gopalmeena94@gmail.com> -Greg Knoll <gregory@bccn-berlin.de> gkBCCN <gregory@bccn-berlin.de> -Greg Yang <sorcererofdm@gmail.com> eulerreich <sorcererofdm@gmail.com> -Greg Young <gfyoung17@gmail.com> gfyoung <gfyoung17@gmail.com> -Greg Young <gfyoung17@gmail.com> gfyoung <gfyoung@mit.edu> +Gael Varoquaux <gael.varoquaux@normalesup.org> +Gerrit Holl <gerrit.holl@gmail.com> <gerrit.holl@utoronto.ca> +Gerrit Holl <gerrit.holl@gmail.com> <g.holl@reading.ac.uk> +Giuseppe Venturini <ggventurini@users.noreply.github.com> +Golnaz Irannejad <golnazirannejad@gmail.com> +Gopal Singh Meena <gopalmeena94@gmail.com> +Greg Knoll <gregory@bccn-berlin.de> +Greg Yang <sorcererofdm@gmail.com> +Greg Young <gfyoung17@gmail.com> +Greg Young <gfyoung17@gmail.com> <gfyoung@mit.edu> +Gregory R. Lee <grlee77@gmail.com> +Gregory R. Lee <grlee77@gmail.com> <gregory.lee@cchmc.org> Guo Ci <zguoci@gmail.com> guoci <zguoci@gmail.com> -Han Genuit <hangenuit@gmail.com> 87 <hangenuit@gmail.com> -Han Genuit <hangenuit@gmail.com> hangenuit@gmail.com <hangenuit@gmail.com> -Han Genuit <hangenuit@gmail.com> Han <hangenuit@gmail.com> +Hameer Abbasi <einstein.edison@gmail.com> <hameerabbasi@yahoo.com> +Han Genuit <hangenuit@gmail.com> Hanno Klemm <hanno.klemm@maerskoil.com> hklemm <hanno.klemm@maerskoil.com> -Hemil Desai <desai38@purdue.edu> hemildesai <desai38@purdue.edu> -Hiroyuki V. Yamazaki <hiroyuki.vincent.yamazaki@gmail.com> hvy <hiroyuki.vincent.yamazaki@gmail.com> -Hugo van Kemenade <hugovk@users.noreply.github.com> Hugo <hugovk@users.noreply.github.com> -Irvin Probst <irvin.probst@ensta-bretagne.fr> I--P <irvin.probst@ensta-bretagne.fr> -Isabela Presedo-Floyd <irpf.design@gmail.com> isabela-pf <ipresedo@calpoly.edu> -Gerhard Hobler <gerhard.hobler@tuwien.ac.at> hobler <gerhard.hobler@tuwien.ac.at> -Guillaume Peillex <guillaume.peillex@gmail.com> hippo91 <guillaume.peillex@gmail.com> -Jaime Fernandez <jaime.frio@gmail.com> Jaime Fernandez <jaime.fernandez@hp.com> -Jaime Fernandez <jaime.frio@gmail.com> jaimefrio <jaime.frio@gmail.com> -Jaime Fernandez <jaime.frio@gmail.com> Jaime <jaime.frio@gmail.com> -Jakob Jakobson <jakobjakobson13@posteo.de> Jakob <jakobjakobson13@posteo.de> -Jakob Jakobson <jakobjakobson13@posteo.de> Jakob Jacobson <jakobjakobson13@posteo.de> -Jakob Jakobson <jakobjakobson13@posteo.de> jakobjakobson13 <43045863+jakobjakobson13@users.noreply.github.com> -James Webber <jamestwebber@gmail.com> jamestwebber <jamestwebber@gmail.com> +Helder Oliveira <heldercro@gmail.com> +Hemil Desai <desai38@purdue.edu> +Hiroyuki V. Yamazaki <hiroyuki.vincent.yamazaki@gmail.com> +Hugo van Kemenade <hugovk@users.noreply.github.com> +Inessa Pawson <albuscode@gmail.com> +Irvin Probst <irvin.probst@ensta-bretagne.fr> +Isabela Presedo-Floyd <irpf.design@gmail.com> <ipresedo@calpoly.edu> +Gerhard Hobler <gerhard.hobler@tuwien.ac.at> +Giannis Zapantis <sdi1900059@di.uoa.gr> +Guillaume Peillex <guillaume.peillex@gmail.com> +Jack J. Woehr <jwoehr@softwoehr.com> +Jaime Fernandez <jaime.frio@gmail.com> +Jaime Fernandez <jaime.frio@gmail.com> <jaime.fernandez@hp.com> +Jaime Fernandez <jaime.frio@gmail.com> <jaimefrio@google.com> +Jamie Macey <dodgerbarker@gmail.com> +Jakob Jakobson <jakobjakobson13@posteo.de> +Jakob Jakobson <jakobjakobson13@posteo.de> <43045863+jakobjakobson13@users.noreply.github.com> +James Bourbeau <jrbourbeau@gmail.com> <jrbourbeau@users.noreply.github.com> +James Webber <jamestwebber@gmail.com> +Jan Schlüter <jan.schlueter@ofai.at> <github@jan-schlueter.de> Jarrod Millman <millman@berkeley.edu> Jarrod Millman <jarrod.millman@gmail.com> -Jason Grout <jason-github@creativetrax.com> Jason Grout <jason.grout@drake.edu> -Jason King <pizza@netspace.net.au> jason king <pizza@netspace.net.au> -Jay Bourque <jay.bourque@continuum.io> jayvius <jay.bourque@continuum.io> -Jean Utke <jutke@allstate.com> jutke <jutke@allstate.com> -Jeffrey Yancey <jeffrey@octane5.com> Jeff <3820914+jeffyancey@users.noreply.github.com> -Jeremy Lay <jlay80@gmail.com> jeremycl01 <jlay80@gmail.com> +Jason Grout <jason-github@creativetrax.com> <jason.grout@drake.edu> +Jason King <pizza@netspace.net.au> +Jay Bourque <jay.bourque@continuum.io> +Jean Utke <jutke@allstate.com> +Jeff VanOss <vanossj@gmail.com> <vanossj@users.noreply.github.com> +Jeffrey Yancey <jeffrey@octane5.com> <3820914+jeffyancey@users.noreply.github.com> +Jeremy Lay <jlay80@gmail.com> Jérémie du Boisberranger <jeremie.du-boisberranger@inria.fr> jeremiedbb <34657725+jeremiedbb@users.noreply.github.com> -Jerome Kelleher <jerome.kelleher@ed.ac.uk> jeromekelleher <jerome.kelleher@ed.ac.uk> -Johannes Hampp <johannes.hampp@zeu.uni-giessen.de> euronion <42553970+euronion@users.noreply.github.com> -Johannes Schönberger <hannesschoenberger@gmail.com> Johannes Schönberger <jschoenberger@demuc.de> -Johann Faouzi <johann.faouzi@gmail.com> johann.faouzi <johann.faouzi@icm-institute.org> -John Darbyshire <24256554+attack68@users.noreply.github.com> attack68 <24256554+attack68@users.noreply.github.com> -John Hagen <johnthagen@gmail.com> johnthagen <johnthagen@users.noreply.github.com> -John Kirkham <kirkhamj@janelia.hhmi.org> jakirkham <jakirkham@gmail.com> -Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> Joseph Fox-Rabinovitz <joseph.r.fox-rabinovitz@nasa.gov> -Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> Joseph Fox-Rabinovitz <madphysicist@users.noreply.github.com> -Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> Mad Physicist <madphysicist@users.noreply.github.com> -Joseph Martinot-Lagarde <contrebasse@gmail.com> Joseph Martinot-Lagarde <joseph.martinot-lagarde@onera.fr> -Julian Taylor <juliantaylor108@gmail.com> Julian Taylor <jtaylor.debian@googlemail.com> -Julian Taylor <juliantaylor108@gmail.com> Julian Taylor <juliantaylor108@googlemail.com> +Jérome Eertmans <jeertmans@icloud.com> +Jerome Kelleher <jerome.kelleher@ed.ac.uk> +Johannes Hampp <johannes.hampp@zeu.uni-giessen.de> <42553970+euronion@users.noreply.github.com> +Johannes Schönberger <hannesschoenberger@gmail.com> <jschoenberger@demuc.de> +Johann Faouzi <johann.faouzi@gmail.com> <johann.faouzi@icm-institute.org> +John Darbyshire <24256554+attack68@users.noreply.github.com> <24256554+attack68@users.noreply.github.com> +John Hagen <johnthagen@gmail.com> <johnthagen@users.noreply.github.com> +John Kirkham <jakirkham@gmail.com> +John Kirkham <jakirkham@gmail.com> <kirkhamj@janelia.hhmi.org> +Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> +Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> <joseph.r.fox-rabinovitz@nasa.gov> +Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> <madphysicist@users.noreply.github.com> +Joseph Martinot-Lagarde <contrebasse@gmail.com> <joseph.martinot-lagarde@onera.fr> +Julian Taylor <juliantaylor108@gmail.com> +Julian Taylor <juliantaylor108@gmail.com> <jtaylor.debian@googlemail.com> +Julian Taylor <juliantaylor108@gmail.com> <jtaylor108@googlemail.com> Julien Lhermitte <jrmlhermitte@gmail.com> Julien Lhermitte <lhermitte@bnl.gov> -Julien Schueller <julien.schueller@gmail.com> jschueller <julien.schueller@gmail.com> -Justus Magin <keewis@posteo.de> keewis <keewis@users.noreply.github.com> -Justus Magin <keewis@posteo.de> Keewis <keewis@posteo.de> -Kai Striega <kaistriega@gmail.com> kai <kaistriega@gmail.com> -Kai Striega <kaistriega@gmail.com> kai-striega <kaistriega@gmail.com> -Kai Striega <kaistriega@gmail.com> kai-striega <kaistriega+github@gmail.com> -Karan Dhir <karan.dhir@berkeley.edu> karan-dhir <kurrandhir@gmail.com> -Khaled Ben Abdallah Okuda <khaled.ben.okuda@gmail.com> KhaledTo <khaled.ben.okuda@gmail.com> +Julien Schueller <julien.schueller@gmail.com> +Justus Magin <keewis@posteo.de> +Justus Magin <keewis@posteo.de> <keewis@users.noreply.github.com> +Kai Striega <kaistriega@gmail.com> +Kai Striega <kaistriega@gmail.com> <kaistriega+github@gmail.com> +Karan Dhir <karan.dhir@berkeley.edu> <kurrandhir@gmail.com> +Kevin Sheppard <kevin.k.sheppard@gmail.com> <bashtage@users.noreply.github.com> +Kevin Sheppard <kevin.k.sheppard@gmail.com> <kevin.sheppard@gmail.com> +Kerem Hallaç <hallackerem@gmail.com> +Khaled Ben Abdallah Okuda <khaled.ben.okuda@gmail.com> Kiko Correoso <kachine@protonmail.com> kikocorreoso <kikocorreoso@gmail.com> Kiko Correoso <kachine@protonmail.com> kikocorreoso <kikocorreoso@users.noreply.github.com> -Konrad Kapp <k_kapp@yahoo.com> k_kapp@yahoo.com <k_kapp@yahoo.com> -Kriti Singh <kritisingh1.ks@gmail.com> kritisingh1 <kritisingh1.ks@gmail.com> -Kmol Yuan <pyslvs@gmail.com> Yuan <pyslvs@gmail.com> +Konrad Kapp <k_kapp@yahoo.com> +Kriti Singh <kritisingh1.ks@gmail.com> +Kmol Yuan <pyslvs@gmail.com> +Kumud Lakara <55556183+kumudlakara@users.noreply.github.com> Lars Buitinck <larsmans@gmail.com> Lars Buitinck <l.buitinck@esciencecenter.nl> Lars Buitinck <larsmans@gmail.com> Lars Buitinck <L.J.Buitinck@uva.nl> -Lars Grüter <lagru@mailbox.org> Lars G <lagru@mailbox.org> -Luis Pedro Coelho <luis@luispedro.org> Luis Pedro Coelho <lpc@cmu.edu> -Luke Zoltan Kelley <lkelley@cfa.harvard.edu> lzkelley <lkelley@cfa.harvard.edu> -Madhulika Jain Chambers <madhulikajain@gmail.com> madhulikajc <53166646+madhulikajc@users.noreply.github.com> -Magdalena Proszewska <magdalena.proszewska@gmail.com> mpro <magdalena.proszewska@gmail.com> -Magdalena Proszewska <magdalena.proszewska@gmail.com> mproszewska <38814059+mproszewska@users.noreply.github.com> -Manoj Kumar <manojkumarsivaraj334@gmail.com> MechCoder <manojkumarsivaraj334@gmail.com> -Marcin Podhajski <podhajskimarcin@gmail.com> m-podhajski <36967358+m-podhajski@users.noreply.github.com> -Mark DePristo <mdepristo@synapdx.com> markdepristo <mdepristo@synapdx.com> -Mark Weissman <mw9050@gmail.com> m-d-w <mw9050@gmail.com> -Mark Wiebe <mwwiebe@gmail.com> Mark <mwwiebe@gmail.com> -Mark Wiebe <mwwiebe@gmail.com> Mark Wiebe <mwiebe@continuum.io> -Mark Wiebe <mwwiebe@gmail.com> Mark Wiebe <mwiebe@enthought.com> -Mark Wiebe <mwwiebe@gmail.com> Mark Wiebe <mwiebe@georg.(none)> -Martin Goodson <martingoodson@gmail.com> martingoodson <martingoodson@gmail.com> -Martin Reinecke <martin@mpa-garching.mpg.de> mreineck <martin@mpa-garching.mpg.de> -Martin Teichmann <martin.teichmann@xfel.eu> Martin Teichmann <lkb.teichmann@gmail.com> -Matt Hancock <not.matt.hancock@gmail.com> matt <mhancock743@gmail.com> -Martino Sorbaro <martino.sorbaro@ed.ac.uk> martinosorb <martino.sorbaro@ed.ac.uk> -Mattheus Ueckermann <empeeu@yahoo.com> empeeu <empeeu@yahoo.com> -Matthew Harrigan <harrigan.matthew@gmail.com> MattHarrigan <harrigan.matthew@gmail.com> -Matti Picus <matti.picus@gmail.com> mattip <matti.picus@gmail.com> -Maximilian Konrad <maximilianlukaskonrad@hotmail.de> MLK97 <maximilianlukaskonrad@hotmail.de> -Melissa Weber Mendonça <melissawm@gmail.com> Melissa Weber Mendonca <melissawm@gmail.com> -Melissa Weber Mendonça <melissawm@gmail.com> melissawm <melissawm@gmail.com> +Lars Grüter <lagru@mailbox.org> +Lars Grüter <lagru@mailbox.org> <lagru@users.noreply.github.com> +Leonardus Chen <leonardus.chen@gmail.com> +Licht Takeuchi <licht-t@outlook.jp> <licht-t@math.dis.titech.ac.jp> +Luis Pedro Coelho <luis@luispedro.org> <lpc@cmu.edu> +Luke Zoltan Kelley <lkelley@cfa.harvard.edu> +Madhulika Jain Chambers <madhulikajain@gmail.com> <53166646+madhulikajc@users.noreply.github.com> +Magdalena Proszewska <magdalena.proszewska@gmail.com> +Magdalena Proszewska <magdalena.proszewska@gmail.com> <38814059+mproszewska@users.noreply.github.com> +Manoj Kumar <manojkumarsivaraj334@gmail.com> +Marcin Podhajski <podhajskimarcin@gmail.com> <36967358+m-podhajski@users.noreply.github.com> +Mark DePristo <mdepristo@synapdx.com> +Mark Weissman <mw9050@gmail.com> +Mark Wiebe <mwwiebe@gmail.com> +Mark Wiebe <mwwiebe@gmail.com> <mwiebe@continuum.io> +Mark Wiebe <mwwiebe@gmail.com> <mwiebe@enthought.com> +Mark Wiebe <mwwiebe@gmail.com> <mwiebe@georg.(none)> +Martin Goodson <martingoodson@gmail.com> +Martin Reinecke <martin@mpa-garching.mpg.de> +Martin Teichmann <martin.teichmann@xfel.eu> <lkb.teichmann@gmail.com> +Mary Conley <sleeplessinseattle.dev@gmail.com> +Matheus Vieira Portela <matheus.v.portela@gmail.com> +Mathieu Lamarre <mlamarre@ea.com> <mathieu@vlam3d.com> +Matías Ríos <riosm@dickinson.edu> +Matt Ord <55235095+Matt-Ord@users.noreply.github.com> +Matt Hancock <not.matt.hancock@gmail.com> <mhancock743@gmail.com> +Martino Sorbaro <martino.sorbaro@ed.ac.uk> +Mattheus Ueckermann <empeeu@yahoo.com> +Matthew Harrigan <harrigan.matthew@gmail.com> +Matthias Bussonnier <bussonniermatthias@gmail.com> <mbussonnier@ucmerced.edu> +Matti Picus <matti.picus@gmail.com> +Maximilian Konrad <maximilianlukaskonrad@hotmail.de> +Melissa Weber Mendonça <melissawm@gmail.com> <melissawm@gmail.com> +Meltem Eren Copur <mecopur@outlook.com> Michael Behrisch <oss@behrisch.de> behrisch <behrisch@users.sourceforge.net> Michael Droettboom <mdboom@gmail.com> mdroe <mdroe@localhost> -Michael K. Tran <trankmichael@gmail.com> mtran <trankmichael@gmail.com> -Michael Martin <mmartin4242@gmail.com> mmartin <mmartin4242@gmail.com> -Michael Schnaitter <schnaitterm@knights.ucf.edu> schnaitterm <schnaitterm@users.noreply.github.com> -Muhammad Kasim <firman.kasim@gmail.com> mfkasim91 <firman.kasim@gmail.com> -Masashi Kishimoto <drehbleistift@gmail.com> kishimoto-banana <drehbleistift@gmail.com> -Nathaniel J. Smith <njs@pobox.com> njsmith <njs@pobox.com> +Michael Dubravski <mdubravski@gmail.com> +Michael Dubravski <mdubravski@gmail.com> <41096057+mdubravski@users.noreply.github.com> +Michael Felt <aixtools@gmail.com> <aixtools@users.noreply.github.com> +Michael Hirsch <scivision@users.noreply.github.com> +Michael K. Tran <trankmichael@gmail.com> +Michael Martin <mmartin4242@gmail.com> +Michael Schnaitter <schnaitterm@knights.ucf.edu> <schnaitterm@users.noreply.github.com> +Michael Seifert <michaelseifert04@yahoo.de> +Michel Fruchart <michel.fruchart@ens-lyon.org> <fruchart@users.noreply.github.com> +Mike Toews <mwtoews@gmail.com> +Mircea Akos Bruma <bruma.mircea.a@gmail.com> +Mircea Akos Bruma <bruma.mircea.a@gmail.com> <akos@debian-gnu-linux-vm.localdomain> +Mitchell Faas <Faas.Mitchell@gmail.com> <35742861+Mitchell-Faas@users.noreply.github.com> +Muhammad Kasim <firman.kasim@gmail.com> +Masashi Kishimoto <drehbleistift@gmail.com> +Mukulikaa Parhari <mukulikapahari@gmail.com> <60316606+Mukulikaa@users.noreply.github.com> +Nathaniel J. Smith <njs@pobox.com> Naveen Arunachalam <notatroll.troll@gmail.com> naveenarun <notatroll.troll@gmail.com> +Neil Girdhar <mistersheik@gmail.com> +Nick Papior <nickpapior@gmail.com> +Nicola Soranzo <nicola.soranzo@gmail.com> <nicola.soranzo@earlham.ac.uk> Nicolas Scheffer <nicolas.scheffer@sri.com> Nicolas Scheffer <scheffer@speech.sri.com> Nicholas A. Del Grosso <delgrosso@bio.lmu.de> nickdg <delgrosso@bio.lmu.de> -Nicholas McKibben <nicholas.bgp@gmail.com> mckib2 <nicholas.bgp@gmail.com> +Nicholas McKibben <nicholas.bgp@gmail.com> Nick Minkyu Lee <mknicklee@protonmail.com> fivemok <9394929+fivemok@users.noreply.github.com> -Ondřej Čertík <ondrej.certik@gmail.com> Ondrej Certik <ondrej.certik@gmail.com> -Óscar Villellas Guillén <oscar.villellas@continuum.io> ovillellas <oscar.villellas@continuum.io> +Oliver Eberle <oliver_eberle@web.de> +Ondřej Čertík <ondrej.certik@gmail.com> +Óscar Villellas Guillén <oscar.villellas@continuum.io> +Panos Mavrogiorgos <pmav99@users.noreply.github.com> Pat Miller <patmiller@localhost> patmiller <patmiller@localhost> -Paul Ivanov <pi@berkeley.edu> Paul Ivanov <paul.ivanov@local> +Paul Ivanov <pivanov5@bloomberg.net> <pi@berkeley.edu> +Paul Ivanov <pivanov5@bloomberg.net> <paul.ivanov@local> Paul YS Lee <leeyspaul@gmail.com> Paul <leeyspaul@users.noreply.github.com> -Paul Jacobson <hpj3@myuw.net> hpaulj <hpj3@myuw.net> -Pearu Peterson <pearu.peterson@gmail.com> Pearu Peterson <pearu@pearu-laptop.(none)> -Pete Peeradej Tanruangporn <pete.tanru@gmail.com> petetanru <pete.tanru@gmail.com> -Peter Bell <peterbell10@live.co.uk> peterbell10 <peterbell10@live.co.uk> -Peter J Cock <p.j.a.cock@googlemail.com> peterjc <p.j.a.cock@googlemail.com> +Paul Jacobson <hpj3@myuw.net> +Pearu Peterson <pearu.peterson@gmail.com> <pearu@pearu-laptop.(none)> +Pete Peeradej Tanruangporn <pete.tanru@gmail.com> +Peter Bell <peterbell10@live.co.uk> +Peter J Cock <p.j.a.cock@googlemail.com> Phil Elson <pelson.pub@gmail.com> -Pierre GM <pierregmcode@gmail.com> pierregm <pierregmcode@gmail.com> +Pierre GM <pierregmcode@gmail.com> Pierre GM <pierregmcode@gmail.com> pierregm <pierregm@localhost> -Piotr Gaiński <dociebieaniuszlem@gmail.com> panpiort8 <dociebieaniuszlem@gmail.com> +Piotr Gaiński <dociebieaniuszlem@gmail.com> Piotr Gaiński <dociebieaniuszlem@gmail.com> Pan Jan <rumcajsgajos@gmail.com> Prabhu Ramachandran <prabhu@localhost> prabhu <prabhu@localhost> -Przemyslaw Bartosik <sendthenote@gmail.com> przemb <sendthenote@gmail.com> +Przemyslaw Bartosik <sendthenote@gmail.com> +Raghuveer Devulapalli <me.raghuveer@gmail.com> <raghuveer.devulapalli@intel.com> +Raghuveer Devulapalli <me.raghuveer@gmail.com> <44766858+r-devulap@users.noreply.github.com> Rajas Rade <raderajas@gmail.com> lkdmttg7 <inprovertmer07@gmail.com> -Ralf Gommers <ralf.gommers@gmail.com> Ralf Gommers <ralf.gommers@googlemail.com> -Ralf Gommers <ralf.gommers@gmail.com> rgommers <ralf.gommers@googlemail.com> -Rehas Sachdeva <aquannie@gmail.com> rehassachdeva <aquannie@gmail.com> -Ritta Narita <narittan@gmail.com> RittaNarita <narittan@gmail.com> -Riya Sharma <navneet.nmk@gmail.com> ayir <navneet.nmk@gmail.com> -Robert Kern <rkern@enthought.com> Robert Kern <robert.kern@gmail.com> -Robert LU <robberphex@gmail.com> RobberPhex <robberphex@gmail.com> +Rakesh Vasudevan <rakesh.nvasudev@gmail.com> +Ralf Gommers <ralf.gommers@gmail.com> <ralf.gommers@googlemail.com> +Rehas Sachdeva <aquannie@gmail.com> +Ritta Narita <narittan@gmail.com> +Riya Sharma <navneet.nmk@gmail.com> +Robert Kern <rkern@enthought.com> <robert.kern@gmail.com> +Robert LU <robberphex@gmail.com> +Robert T. McGibbon <rmcgibbo@gmail.com> +Roland Kaufmann <rka081+numpy@uib.no> <roland.kaufmann@uni.no> +Roman Yurchak <rth.yurchak@gmail.com> <rth.yurchak@pm.me> Ronan Lamy <ronan.lamy@gmail.com> Ronan Lamy <Ronan.Lamy@normalesup.org> -Russell Hewett <rhewett@mit.edu> rhewett <rhewett@mit.edu> -Ryan Blakemore <rbtnet@gmail.com> ryanblak <rbtnet@gmail.com> -Sam Preston <j.sam.preston@gmail.com> jspreston <j.sam.preston@gmail.com> -Sam Radhakrishnan <sk09idm@gmail.com> = <=> -Sam Radhakrishnan <sk09idm@gmail.com> sam09 <sk09idm@gmail.com> -Sanchez Gonzalez Alvaro <as12513@imperial.ac.uk> alvarosg <as12513@imperial.ac.uk> -Saullo Giovani <saullogiovani@gmail.com> saullogiovani <saullogiovani@gmail.com> +Russell Hewett <rhewett@mit.edu> +Ryan Blakemore <rbtnet@gmail.com> +Ryan Polley <rypolley@gmail.com> <rypolley+github@gmail.com> +Ryan Soklaski <rsoklaski@gmail.com> <ry26099@mit.edu> +Ryan Soklaski <rsoklaski@gmail.com> <ryan.soklaski@gmail.com> +Sabrina Simao <sabrina_simao@hotmail.com> +Sabrina Simao <sabrina_simao@hotmail.com> SabrinaSimao <sabrinass@al.insper.edu.br> +Sam Preston <j.sam.preston@gmail.com> +Sam Radhakrishnan <sk09idm@gmail.com> = <=> # committed without an email address +Samesh Lakhotia <samesh.lakhotia@gmail.com> +Samesh Lakhotia <samesh.lakhotia@gmail.com> <43701530+sameshl@users.noreply.github.com> +Sami Salonen <ssalonen@gmail.com> <sami.salonen@eniram.fi> +Sanchez Gonzalez Alvaro <as12513@imperial.ac.uk> +Saullo Giovani <saullogiovani@gmail.com> Saurabh Mehta <e.samehta@gmail.com> -Sebastian Berg <sebastian@sipsolutions.net> seberg <sebastian@sipsolutions.net> -Sergei Vorfolomeev <svorfolomeev@vmssoftware.com> vorfol <39548292+vorfol@users.noreply.github.com> -Shekhar Prasad Rajak <shekharrajak@live.com> shekharrajak <shekharrajak@live.com> -Shota Kawabuchi <shota.kawabuchi+GitHub@gmail.com> skwbc <shota.kawabuchi+GitHub@gmail.com> -Siavash Eliasi <siavashserver@gmail.com> siavashserver <siavashserver@gmail.com> -Simon Gasse <simon.gasse@gmail.com> sgasse <sgasse@users.noreply.github.com> -Søren Rasmussen <soren.rasmussen@alexandra.dk> sorenrasmussenai <47032123+sorenrasmussenai@users.noreply.github.com> -Stefan Behnel <stefan_ml@behnel.de> scoder <stefan_ml@behnel.de> -Stefan van der Walt <stefanv@berkeley.edu> Stefan van der Walt <sjvdwalt@gmail.com> -Stefan van der Walt <stefanv@berkeley.edu> Stefan van der Walt <stefan@sun.ac.za> -Stephan Hoyer <shoyer@gmail.com> Stephan Hoyer <shoyer@climate.com> +Sebastian Berg <sebastian@sipsolutions.net> +Sergei Vorfolomeev <svorfolomeev@vmssoftware.com> <39548292+vorfol@users.noreply.github.com> +Shekhar Prasad Rajak <shekharrajak@live.com> +Shen Zhou <shen_zhou@u.nus.edu> +Shota Kawabuchi <shota.kawabuchi+GitHub@gmail.com> +Siavash Eliasi <siavashserver@gmail.com> +Simon Conseil <contact@saimon.org> <simon.conseil@univ-lyon1.fr> +Simon Gasse <simon.gasse@gmail.com> +Simon Gasse <simon.gasse@gmail.com> <sgasse@users.noreply.github.com> +Søren Rasmussen <soren.rasmussen@alexandra.dk> <47032123+sorenrasmussenai@users.noreply.github.com> +Spencer Hill <spencerahill@gmail.com> <shill@atmos.ucla.edu> +Stefan Behnel <stefan_ml@behnel.de> +Stefan van der Walt <stefanv@berkeley.edu> <sjvdwalt@gmail.com> +Stefan van der Walt <stefanv@berkeley.edu> <stefan@sun.ac.za> +Stephan Hoyer <shoyer@gmail.com> <shoyer@climate.com> +Stephan Hoyer <shoyer@gmail.com> <shoyer@google.com> +Steve Stagg <stestagg@gmail.com> <ste@sta.gg> Steven J Kern <kern.steven0@gmail.com> -Stuart Archibald <stuart.archibald@googlemail.com> stuartarchibald <stuartarchibald@users.noreply.github.com> -SuryaChand P <psschand@gmail.com> Surya P <psschand@gmail.com> -SuryaChand P <psschand@gmail.com> psschand <psschand@gmail.com> -Takanori Hirano <takanori17h@gmail.com> takanori-pskq <takanori17h@gmail.com> -Takanori H <takanori17h@gmail.com> takanori-pskq <takanori17h@gmail.com> -Thomas A Caswell <tcaswell@gmail.com> Thomas A Caswell <tcaswell@bnl.gov> -Tim Cera <tim@cerazone.net> tim cera <tcera@sjrwmd.com> -Tim Teichmann <t.teichmann@dashdos.com> tteichmann <t.teichmann@dashdos.com> -Tim Teichmann <t.teichmann@dashdos.com> tteichmann <44259103+tteichmann@users.noreply.github.com> -Tirth Patel <tirthasheshpatel@gmail.com> tirthasheshpatel <tirthasheshpatel@gmail.com> -Tobias Pitters <tobias.pitters@gmx.de> CloseChoice <tobias.pitters@gmx.de> -Tobias Pitters <tobias.pitters@gmx.de> <31857876+CloseChoice@users.noreply.github.com> -Tom Boyd <pezcore@users.noreply.github.com> pezcore <pezcore@users.noreply.github.com> -Tom Poole <t.b.poole@gmail.com> tpoole <t.b.poole@gmail.com> -Tony LaTorre <tlatorre@uchicago.edu> tlatorre <tlatorre@uchicago.edu> -Travis Oliphant <travis@continuum.io> Travis E. Oliphant <teoliphant@gmail.com> -Travis Oliphant <travis@continuum.io> Travis Oliphant <oliphant@enthought.com> -Valentin Haenel <valentin@haenel.co> Valentin Haenel <valentin.haenel@gmx.de> -Rakesh Vasudevan <rakesh.nvasudev@gmail.com> vrakesh <rakesh.nvasudev@gmail.com> -Vrinda Narayan <talk2vrinda@gmail.com> vrindaaa <48102157+vrindaaa@users.noreply.github.com> -Wansoo Kim <rladhkstn8@gmail.com> marload <rladhkstn8@gmail.com> -Warren Weckesser <warren.weckesser@enthought.com> Warren Weckesser <warren.weckesser@gmail.com> -Weitang Li <liwt31@163.com> wtli@Dirac <liwt31@163.com> -Weitang Li <liwt31@163.com> wtli <liwt31@163.com> -Wendell Smith <wendellwsmith@gmail.com> Wendell Smith <wackywendell@gmail.com> -Wim Glenn <wim.glenn@melbourneit.com.au> wim glenn <wim.glenn@melbourneit.com.au> -Wojtek Ruszczewski <git@wr.waw.pl> wrwrwr <git@wr.waw.pl> -Yogesh Raisinghani <vanshita12004@gmail.com> raisinghanii <46864533+raisinghanii@users.noreply.github.com> -Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com> kngwyu <yuji.kngw.80s.revive@gmail.com> -Yury Kirienko <yury.kirienko@gmail.com> kirienko <yury.kirienko@gmail.com> -Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com> Zac-HD <zac.hatfield.dodds@gmail.com> -Zixu Zhao <zixu.zhao.tireless@gmail.com> ZZhaoTireless <zixu.zhao.tireless@gmail.com> -Ziyan Zhou <ziyan.zhou@mujin.co.jp> Ziyan <ziyan.zhou@mujin.co.jp> -Zieji Pohz <poh.ziji@gmail.com> jpoh <poh.zijie@gmail.com> -Zieji Pohz <poh.ziji@gmail.com> zjpoh <poh.zijie@gmail.com> -Zieji Pohz <poh.ziji@gmail.com> Zijie (ZJ) Poh <8103276+zjpoh@users.noreply.github.com> -Zolisa Bleki <zolisa.bleki@gmail.com> zoj613 <44142765+zoj613@users.noreply.github.com> -Zolisa Bleki <zolisa.bleki@gmail.com> RedRuM <44142765+zoj613@users.noreply.github.com> -luzpaz <kunda@scribus.net> luz.paz <luzpaz@users.noreply.github.com> -luzpaz <kunda@scribus.net> luzpaz <luzpaz@users.noreply.github.com> -spacescientist <aspacescientist@protonmail.com> spacescientist <spacescientist@pm.me> +Stuart Archibald <stuart.archibald@googlemail.com> <stuart@opengamma.com> +Stuart Archibald <stuart.archibald@googlemail.com> <stuartarchibald@users.noreply.github.com> +SuryaChand P <psschand@gmail.com> +Takanori Hirano <takanori17h@gmail.com> +Thomas A Caswell <tcaswell@gmail.com> <tcaswell@bnl.gov> +Thomas Kluyver <takowl@gmail.com> <thomas@kluyver.me.uk> +Thomas Orgis <thomas.orgis@uni-hamburg.de> +Tim Cera <tim@cerazone.net> <tcera@sjrwmd.com> +Tim Teichmann <t.teichmann@dashdos.com> +Tim Teichmann <t.teichmann@dashdos.com> <44259103+tteichmann@users.noreply.github.com> +Tirth Patel <tirthasheshpatel@gmail.com> +Tobias Pitters <tobias.pitters@gmail.com> <tobias.pitters@gmx.de> +Tobias Pitters <tobias.pitters@gmail.com> <31857876+CloseChoice@users.noreply.github.com> +Tobias Uelwer <tobias.uelwer@googlemail.com> <tobias.uelwer@uni-duesseldorf.de> +Tom Boyd <tboyd@scitec.com> <pezcore@users.noreply.github.com> +Tom Poole <t.b.poole@gmail.com> +Tong Zou <tongzou@uw.edu> +Tony LaTorre <tlatorre@uchicago.edu> +Toshiki Kataoka <kataoka@preferred.jp> <tos.lunar@gmail.com> +Travis Oliphant <teoliphant@gmail.com> +Travis Oliphant <teoliphant@gmail.com> <oliphant@enthought.com> +Travis Oliphant <teoliphant@gmail.com> <travis@continuum.io> +Valentin Haenel <valentin@haenel.co> <valentin.haenel@gmx.de> +Valentin Haenel <valentin@haenel.co> <vhaenel@anaconda.com> +Varun Nayyar <nayyarv@gmail.com> <nayyarv@users.noreply.github.com> +Vrinda Narayan <talk2vrinda@gmail.com> <vrinda18120@iiitd.ac.in> +Vrinda Narayan <talk2vrinda@gmail.com> <48102157+vrindaaa@users.noreply.github.com> +Wansoo Kim <rladhkstn8@gmail.com> +Warren Weckesser <warren.weckesser@gmail.com> <warren.weckesser@enthought.com> +Weitang Li <liwt31@163.com> +Wendell Smith <wendellwsmith@gmail.com> <wackywendell@gmail.com> +William Spotz <wfspotz@sandia.gov> <wfspotz@sandia.gov@localhost> +Wim Glenn <wim.glenn@melbourneit.com.au> +Wojtek Ruszczewski <git@wr.waw.pl> +Wojciech Rzadkowski <wojciech.rzadkowski@gmail.com> <33913808+wrzadkow@users.noreply.github.com> +Yang Hau <yuanyanghau@gmail.com> +Yang Hau <yuanyanghau@gmail.com> <vulxj0j8j8@gmail.com> +Yogesh Raisinghani <vanshita12004@gmail.com> <46864533+raisinghanii@users.noreply.github.com> +Yu Feng <rainwoodman@gmail.com> <feyu@google.com> +Yuji Kanagawa <yuji.kngw.80s.revive@gmail.com> +Yury Kirienko <yury.kirienko@gmail.com> +Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com> +Zé Vinícius <jvmirca@gmail.com> +Zixu Zhao <zixu.zhao.tireless@gmail.com> +Ziyan Zhou <ziyan.zhou@mujin.co.jp> +Zieji Pohz <poh.ziji@gmail.com> +Zieji Pohz <poh.ziji@gmail.com> <8103276+zjpoh@users.noreply.github.com> +Zolboo Erdenebaatar <erdenebz@dickinson.edu> +Zolisa Bleki <zolisa.bleki@gmail.com> <44142765+zoj613@users.noreply.github.com> +~DWesl <22566757+DWesl@users.noreply.github.com> +~Endolith <endolith@gmail.com> +~FX Coudert <fxcoudert@gmail.com> +~Illviljan <14371165+Illviljan@users.noreply.github.com> +~LSchroefl <65246829+LSchroefl@users.noreply.github.com> +~Lbogula <bogulala7@gmail.com> +~Patrick <39380924+xamm@users.noreply.github.com> +~Scian <65375075+hoony6134@users.noreply.github.com> +~h-vetinari <h.vetinari@gmx.com> +~h6197627 <44726212+h6197627@users.noreply.github.com> +~jbCodeHub <besselingcodehub@gmail.com> +~legoffant <58195095+legoffant@users.noreply.github.com> +~luzpaz <kunda@scribus.net> +~luzpaz <kunda@scribus.net> <luzpaz@users.noreply.github.com> +~sfolje0 <sfolje0@github> +~spacescientist <aspacescientist@protonmail.com> <spacescientist@pm.me> +~tautaus <sunt9751@gmail.com> +~xoviat <49173759+xoviat@users.noreply.github.com> +~xoviat <49173759+xoviat@users.noreply.github.com> <xoviat@users.noreply.github.com> +~yetanothercheer <yetanothercheer@protonmail.com> diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dd189b8e9..14a59e880 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,7 +19,7 @@ stages: jobs: - job: Lint - condition: and(succeeded(), ne(variables['Build.SourceBranch'], 'refs/heads/main')) # skip for PR merges + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) pool: vmImage: 'ubuntu-18.04' steps: diff --git a/doc/release/upcoming_changes/15271.compatibility.rst b/doc/release/upcoming_changes/15271.compatibility.rst deleted file mode 100644 index 7deefe256..000000000 --- a/doc/release/upcoming_changes/15271.compatibility.rst +++ /dev/null @@ -1,31 +0,0 @@ -Error type changes in universal functions ------------------------------------------ -The universal functions may now raise different errors -on invalid input in some cases. -The main changes should be that a ``RuntimeError`` was -replaced with a more fitting ``TypeError``. -When multiple errors were present in the same call, -NumPy may now raise a different one. - - -``__array_ufunc__`` argument validation ---------------------------------------- -NumPy will now partially validate arguments before calling -``__array_ufunc__``. Previously, it was possible to pass -on invalid arguments (such as a non-existing keyword -argument) when dispatch was known to occur. - - -``__array_ufunc__`` and additional positional arguments -------------------------------------------------------- -Previously, all positionally passed arguments were checked for -``__array_ufunc__`` support. In the case of ``reduce``, -``accumulate``, and ``reduceat`` all arguments may be passed by -position. This means that when they were passed by -position, they could previously have been asked to handle -the ufunc call via ``__array_ufunc__``. -Since this depended on the way the arguments were passed -(by position or by keyword), NumPy will now only dispatch -on the input and output array. -For example, NumPy will never dispatch on the ``where`` array -in a reduction such as ``np.add.reduce``. diff --git a/doc/release/upcoming_changes/16987.improvement.rst b/doc/release/upcoming_changes/16987.improvement.rst deleted file mode 100644 index dc592a068..000000000 --- a/doc/release/upcoming_changes/16987.improvement.rst +++ /dev/null @@ -1,17 +0,0 @@ -Arbitrary ``period`` option for `numpy.unwrap` ----------------------------------------------- -The size of the interval over which phases are unwrapped is no longer restricted to ``2 * pi``. -This is especially useful for unwrapping degrees, but can also be used for other intervals. - -.. code:: python - - >>> phase_deg = np.mod(np.linspace(0,720,19), 360) - 180 - >>> phase_deg - array([-180., -140., -100., -60., -20., 20., 60., 100., 140., - -180., -140., -100., -60., -20., 20., 60., 100., 140., - -180.]) - - >>> unwrap(phase_deg, period=360) - array([-180., -140., -100., -60., -20., 20., 60., 100., 140., - 180., 220., 260., 300., 340., 380., 420., 460., 500., - 540.]) diff --git a/doc/release/upcoming_changes/17492.deprecation.rst b/doc/release/upcoming_changes/17492.deprecation.rst deleted file mode 100644 index 50005aed7..000000000 --- a/doc/release/upcoming_changes/17492.deprecation.rst +++ /dev/null @@ -1,7 +0,0 @@ -Inexact matches for `numpy.convolve` and `numpy.correlate` are deprecated -------------------------------------------------------------------------- - -`numpy.convolve` and `numpy.correlate` now emits a warning when there are case -insensitive and/or inexact matches found for ``mode`` argument in the functions. -Pass full ``"same"``, ``"valid"``, ``"full"`` strings instead of -``"s"``, ``"v"``, ``"f"`` for the ``mode`` argument. diff --git a/doc/release/upcoming_changes/17586.deprecation.rst b/doc/release/upcoming_changes/17586.deprecation.rst deleted file mode 100644 index 845615315..000000000 --- a/doc/release/upcoming_changes/17586.deprecation.rst +++ /dev/null @@ -1,7 +0,0 @@ -``np.typeDict`` has been formally deprecated --------------------------------------------- -``np.typeDict`` is a deprecated alias for ``np.sctypeDict`` and -has been so for over 14 years (6689502_). -A deprecation warning will now be issued whenever getting ``np.typeDict``. - -.. _6689502: https://github.com/numpy/numpy/commit/668950285c407593a368336ff2e737c5da84af7d diff --git a/doc/release/upcoming_changes/17727.performance.rst b/doc/release/upcoming_changes/17727.performance.rst deleted file mode 100755 index 55ab7752b..000000000 --- a/doc/release/upcoming_changes/17727.performance.rst +++ /dev/null @@ -1,7 +0,0 @@ -Improved performance in integer division of NumPy arrays --------------------------------------------------------- -Integer division of NumPy arrays now uses `libdivide <https://libdivide.com/>` -when the divisor is a constant. With the usage of libdivide and -other minor optimizations, there is a large speedup. -The ``//`` operator and ``np.floor_divide`` makes use -of the new changes. diff --git a/doc/release/upcoming_changes/17843.new_feature.rst b/doc/release/upcoming_changes/17843.new_feature.rst deleted file mode 100644 index d2b9d2adc..000000000 --- a/doc/release/upcoming_changes/17843.new_feature.rst +++ /dev/null @@ -1,22 +0,0 @@ -Added a mypy plugin for handling platform-specific `numpy.number` precisions ----------------------------------------------------------------------------- - -A mypy_ plugin is now available for automatically assigning the (platform-dependent) -precisions of certain `~numpy.number` subclasses, including the likes of -`~numpy.int_`, `~numpy.intp` and `~numpy.longlong`. See the documentation on -:ref:`scalar types <arrays.scalars.built-in>` for a comprehensive overview -of the affected classes. - -Note that while usage of the plugin is completely optional, without it the -precision of above-mentioned classes will be inferred as `~typing.Any`. - -To enable the plugin, one must add it to their mypy `configuration file`_: - -.. code-block:: ini - - [mypy] - plugins = numpy.typing.mypy_plugin - - -.. _mypy: http://mypy-lang.org/ -.. _configuration file: https://mypy.readthedocs.io/en/stable/config_file.html diff --git a/doc/release/upcoming_changes/17900.expired.rst b/doc/release/upcoming_changes/17900.expired.rst deleted file mode 100644 index 810d67241..000000000 --- a/doc/release/upcoming_changes/17900.expired.rst +++ /dev/null @@ -1,2 +0,0 @@ -* The ``shape`` argument `numpy.unravel_index` cannot be passed - as ``dims`` keyword argument anymore. (Was deprecated in NumPy 1.16.) diff --git a/doc/release/upcoming_changes/17921.compatibility.rst b/doc/release/upcoming_changes/17921.compatibility.rst deleted file mode 100644 index a1e2fb2d0..000000000 --- a/doc/release/upcoming_changes/17921.compatibility.rst +++ /dev/null @@ -1,6 +0,0 @@ -Validate input values in ``Generator.uniform`` ----------------------------------------------- -Checked that ``high - low >= 0`` in ``np.random.Generator.uniform``. Raises -``ValueError`` if ``low > high``. Previously out-of-order inputs were accepted -and silently swapped, so that if ``low > high``, the value generated was -``high + (low - high) * random()``. diff --git a/doc/release/upcoming_changes/18070.improvement.rst b/doc/release/upcoming_changes/18070.improvement.rst deleted file mode 100644 index ae750fb12..000000000 --- a/doc/release/upcoming_changes/18070.improvement.rst +++ /dev/null @@ -1,12 +0,0 @@ -``np.unique`` now returns single ``NaN`` ----------------------------------------- -When ``np.unique`` operated on an array with multiple ``NaN`` entries, -its return included a ``NaN`` for each entry that was ``NaN`` in the original array. -This is now improved such that the returned array contains just one ``NaN`` as the -last element. - -Also for complex arrays all ``NaN`` values are considered equivalent -(no matter whether the ``NaN`` is in the real or imaginary part). As the -representant for the returned array the smallest one in the -lexicographical order is chosen - see ``np.sort`` for how the lexicographical -order is defined for complex arrays.
\ No newline at end of file diff --git a/doc/release/upcoming_changes/18110.change.rst b/doc/release/upcoming_changes/18110.change.rst deleted file mode 100644 index 7dbf8e5b7..000000000 --- a/doc/release/upcoming_changes/18110.change.rst +++ /dev/null @@ -1,5 +0,0 @@ -`numpy.piecewise` output class now matches the input class ----------------------------------------------------------- -When `numpy.ndarray` subclasses are used on input to `numpy.piecewise`, -they are passed on to the functions. The output will now be of the -same subclass as well. diff --git a/doc/release/upcoming_changes/18116.future.rst b/doc/release/upcoming_changes/18116.future.rst deleted file mode 100644 index 1eb14d5f7..000000000 --- a/doc/release/upcoming_changes/18116.future.rst +++ /dev/null @@ -1,29 +0,0 @@ -Promotion of strings with numbers and bools is deprecated ---------------------------------------------------------- -Any promotion of numbers and strings is deprecated and will -give a ``FutureWarning`` the main affected functionalities -are: - -* `numpy.promote_types` and `numpy.result_type` which will raise - an error in this case in the future. -* `numpy.concatenate` will raise an error when concatenating a string - and numeric array. You can use ``dtype="S"`` to explicitly request - a string result. -* `numpy.array` and related functions will start returning ``object`` - arrays because these functions use ``object`` as a fallback when - no common dtype can be found. However, it may happen that future - releases of NumPy will generally error in these cases. - -This will mainly affect code such as:: - - np.asarray(['string', 0]) - -and:: - - np.concatenate((['string'], [0])) - -in both cases adding ``dtype="U"`` or ``dtype="S"`` will give the -previous (string) result, while ``dtype=object`` will ensure an array with -object dtype is returned. - -Comparisons, universal functions, and casting are not affected by this. diff --git a/doc/release/upcoming_changes/18322.new_feature.rst b/doc/release/upcoming_changes/18322.new_feature.rst deleted file mode 100644 index 5330b9a97..000000000 --- a/doc/release/upcoming_changes/18322.new_feature.rst +++ /dev/null @@ -1,22 +0,0 @@ -Let the mypy plugin manage extended-precision `numpy.number` subclasses ------------------------------------------------------------------------ - -The mypy_ plugin, introduced in `numpy/numpy#17843`_, has been expanded: -the plugin now removes annotations for platform-specific extended-precision -types that are not available to the platform in question. -For example, it will remove `~numpy.float128` when not available. - -Without the plugin *all* extended-precision types will, as far as mypy is concerned, -be available on all platforms. - -To enable the plugin, one must add it to their mypy `configuration file`_: - -.. code-block:: ini - - [mypy] - plugins = numpy.typing.mypy_plugin - - -.. _mypy: http://mypy-lang.org/ -.. _configuration file: https://mypy.readthedocs.io/en/stable/config_file.html -.. _`numpy/numpy#17843`: https://github.com/numpy/numpy/pull/17843 diff --git a/doc/release/upcoming_changes/18629.new_feature.rst b/doc/release/upcoming_changes/18629.new_feature.rst deleted file mode 100644 index 7d75c323f..000000000 --- a/doc/release/upcoming_changes/18629.new_feature.rst +++ /dev/null @@ -1,10 +0,0 @@ -New ``min_digits`` argument for printing float values ------------------------------------------------------ -A new ``min_digits`` argument has been added to the dragon4 float printing -functions `np.format_float_positional` and `np.format_float_scientific` . This -kwd guarantees that at least the given number of digits will be printed when -printing in unique=True mode, even if the extra digits are unnecessary to -uniquely specify the value. It is the counterpart to the precision argument -which sets the maximum number of digits to be printed. When unique=False in -fixed precision mode, it has no effect and the precision argument fixes the -number of digits. diff --git a/doc/release/upcoming_changes/18657.performance.rst b/doc/release/upcoming_changes/18657.performance.rst deleted file mode 100644 index b9d436725..000000000 --- a/doc/release/upcoming_changes/18657.performance.rst +++ /dev/null @@ -1,10 +0,0 @@ -Improve performance of ``np.save`` and ``np.load`` for small arrays -------------------------------------------------------------------- -``np.save`` is now a lot faster for small arrays. - -``np.load`` is also faster for small arrays, -but only when serializing with a version >= `(3, 0)`. - -Both are done by removing checks that are only relevant for Python 2, -while still maintaining compatibility with arrays -which might have been created by Python 2. diff --git a/doc/release/upcoming_changes/18658.compatibility.rst b/doc/release/upcoming_changes/18658.compatibility.rst deleted file mode 100644 index bb4052b9d..000000000 --- a/doc/release/upcoming_changes/18658.compatibility.rst +++ /dev/null @@ -1,6 +0,0 @@ -``/usr/include`` removed from default include paths ---------------------------------------------------- -The default include paths when building a package with ``numpy.distutils`` no -longer include ``/usr/include``. This path is normally added by the compiler, -and hardcoding it can be problematic. In case this causes a problem, please -open an issue. A workaround is documented in PR 18658. diff --git a/doc/release/upcoming_changes/18666.improvement.rst b/doc/release/upcoming_changes/18666.improvement.rst deleted file mode 100644 index 70b87ecf4..000000000 --- a/doc/release/upcoming_changes/18666.improvement.rst +++ /dev/null @@ -1,9 +0,0 @@ -``Generator.rayleigh`` and ``Generator.geometric`` performance improved ------------------------------------------------------------------------ -The performance of Rayleigh and geometric random variate generation -in ``Generator`` has improved. These are both transformation of exponential -random variables and the slow log-based inverse cdf transformation has -been replaced with the Ziggurat-based exponential variate generator. - -This change breaks the stream of variates generated when variates from -either of these distributions are produced. diff --git a/doc/release/upcoming_changes/18695.new_feature.rst b/doc/release/upcoming_changes/18695.new_feature.rst deleted file mode 100644 index a1f108176..000000000 --- a/doc/release/upcoming_changes/18695.new_feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -f2py now recognizes Fortran abstract interface blocks ------------------------------------------------------ -`np.f2py` can now parse abstract interface blocks. diff --git a/doc/release/upcoming_changes/18697.expired.rst b/doc/release/upcoming_changes/18697.expired.rst deleted file mode 100644 index 5a45ce216..000000000 --- a/doc/release/upcoming_changes/18697.expired.rst +++ /dev/null @@ -1,5 +0,0 @@ -* The function ``PyUFunc_GenericFunction`` has been disabled. - It was deprecated in NumPy 1.19. Users should call the ufunc - directly using the Python API. -* The function ``PyUFunc_SetUsesArraysAsData`` has been disabled. - It was deprecated in NumPy 1.19. diff --git a/doc/release/upcoming_changes/18718.c_api.rst b/doc/release/upcoming_changes/18718.c_api.rst deleted file mode 100644 index eb9121ab6..000000000 --- a/doc/release/upcoming_changes/18718.c_api.rst +++ /dev/null @@ -1,13 +0,0 @@ -Use of ``ufunc->type_resolver`` and "type tuple" ------------------------------------------------- -NumPy now normalizes the "type tuple" argument to the -type resolver functions before calling it. Note that in -the use of this type resolver is legacy behaviour and NumPy -will not do so when possible. -Calling ``ufunc->type_resolver`` or ``PyUFunc_DefaultTypeResolver`` -is strongly discouraged and will now enforce a normalized -type tuple if done. -Note that this does not affect providing a type resolver, which -is expected to keep working in most circumstances. -If you have an unexpected use-case for calling the type resolver, -please inform the NumPy developers so that a solution can be found. diff --git a/doc/release/upcoming_changes/18718.compatibility.rst b/doc/release/upcoming_changes/18718.compatibility.rst deleted file mode 100644 index 18bf7158d..000000000 --- a/doc/release/upcoming_changes/18718.compatibility.rst +++ /dev/null @@ -1,59 +0,0 @@ -Changes to comparisons with ``dtype=...`` ------------------------------------------ -When the ``dtype=`` (or ``signature``) arguments to comparison -ufuncs (``equal``, ``less``, etc.) is used, this will denote -the desired output dtype in the future. -This means that: - - np.equal(2, 3, dtype=object) - -will give a ``FutureWarning`` that it will return an ``object`` -array in the future, which currently happens for: - - np.equal(None, None, dtype=object) - -due to the fact that ``np.array(None)`` is already an object -array. (This also happens for some other dtypes.) - -Since comparisons normally only return boolean arrays, providing -any other dtype will always raise an error in the future and -give a ``DeprecationWarning`` now. - - -Changes to ``dtype`` and ``signature`` arguments in ufuncs ----------------------------------------------------------- -The universal function arguments ``dtype`` and ``signature`` -which are also valid for reduction such as ``np.add.reduce`` -(which is the implementation for ``np.sum``) will now issue -a warning when the ``dtype`` provided is not a "basic" dtype. - -NumPy almost always ignored metadata, byteorder or time units -on these inputs. NumPy will now always ignore it and raise an -error if byteorder or time unit changed. -The following are the most important examples of changes which -will give the error. In some cases previously the information -stored was not ignored, in all of these an error is now raised:: - - # Previously ignored the byte-order (affect if non-native) - np.add(3, 5, dtype=">i32") - - # The biggest impact is for timedelta or datetimes: - arr = np.arange(10, dtype="m8[s]") - # The examples always ignored the time unit "ns": - np.add(arr, arr, dtype="m8[ns]") - np.maximum.reduce(arr, dtype="m8[ns]") - - # The following previously did use "ns" (as opposed to `arr.dtype`) - np.add(3, 5, dtype="m8[ns]") # Now return generic time units - np.maximum(arr, arr, dtype="m8[ns]") # Now returns "s" (from `arr`) - -The same applies for functions like ``np.sum`` which use these internally. -This change is necessary to achieve consistent handling within NumPy. - -If you run into these, in most cases pass for example ``dtype=np.timedelta64`` -which clearly denotes a general ``timedelta64`` without any unit or byte-order -defined. If you need to specify the output dtype precisely, you may do so -by either casting the inputs or providing an output array using `out=`. - -NumPy may choose to allow providing an exact output ``dtype`` here in the -future, which would be preceded by a ``FutureWarning``. diff --git a/doc/release/upcoming_changes/18737.new_feature.rst b/doc/release/upcoming_changes/18737.new_feature.rst deleted file mode 100644 index e451ac90a..000000000 --- a/doc/release/upcoming_changes/18737.new_feature.rst +++ /dev/null @@ -1,12 +0,0 @@ -BLAS and LAPACK configuration via environment variables -------------------------------------------------------- -Autodetection of installed BLAS and LAPACK libraries can be bypassed by using -the ``NPY_BLAS_LIBS`` and ``NPY_LAPACK_LIBS`` environment variables. Instead, -the link flags in these environment variables will be used directly, and the -language is assumed to be F77. This is especially useful in automated builds -where the BLAS and LAPACK that are installed are known exactly. A use case is -replacing the actual implementation at runtime via stub library links. - -If ``NPY_CBLAS_LIBS`` is set (optional in addition to ``NPY_BLAS_LIBS``), this -will be used as well, by defining ``HAVE_CBLAS`` and appending the environment -variable content to the link flags. diff --git a/doc/release/upcoming_changes/18874.change.rst b/doc/release/upcoming_changes/18874.change.rst deleted file mode 100644 index c86fed83e..000000000 --- a/doc/release/upcoming_changes/18874.change.rst +++ /dev/null @@ -1,11 +0,0 @@ -Enable Accelerate Framework ----------------------------- -With the release of macOS 11.3, several different issues that -numpy was encountering when using Accelerate Framework's -implementation of BLAS and LAPACK should be resolved. This -change enables the Accelerate Framework as an option on macOS. -If additional issues are found, please file a bug report -against Accelerate using the developer feedback assistant -tool (https://developer.apple.com/bug-reporting/). We -intend to address issues promptly and plan to continue -supporting and updating our BLAS and LAPACK libraries. diff --git a/doc/release/upcoming_changes/18880.compatibility.rst b/doc/release/upcoming_changes/18880.compatibility.rst deleted file mode 100644 index 4951463cf..000000000 --- a/doc/release/upcoming_changes/18880.compatibility.rst +++ /dev/null @@ -1,34 +0,0 @@ -Ufunc ``signature=...`` and ``dtype=`` generalization and ``casting`` ---------------------------------------------------------------------- -The behaviour for ``np.ufunc(1.0, 1.0, signature=...)`` or -``np.ufunc(1.0, 1.0, dtype=...)`` can now yield different loops in 1.21 -compared to 1.20 because of changes in promotion. -When ``signature`` was previously used, the casting check on inputs -was relaxed, which could lead to downcasting inputs unsafely especially -if combined with ``casting="unsafe"``. - -Casting is now guaranteed to be safe. If a signature is only -partially provided, for example using ``signature=("float64", None, None)``, -this could lead to no loop being found (an error). -In that case, it is necessary to provide the complete signature -to enforce casting the inputs. -If ``dtype="float64"`` is used or only outputs are set (e.g. -``signature=(None, None, "float64")`` the is unchanged. -We expect that very few users are affected by this change. - -Further, the meaning of ``dtype="float64"`` has been slightly modified and -now strictly enforces only the correct output (and not input) DTypes. -This means it is now always equivalent to:: - - signature=(None, None, "float64") - -(If the ufunc has two inputs and one output). Since this could lead -to no loop being found in some cases, NumPy will normally also search -for the loop:: - - signature=("float64", "float64", "float64") - -if the first search failed. -In the future, this behaviour may be customized to achieve the expected -results for more complex ufuncs. (For some universal functions such as -``np.ldexp`` inputs can have different DTypes.) diff --git a/doc/release/upcoming_changes/18906.new_function.rst b/doc/release/upcoming_changes/18906.new_function.rst deleted file mode 100644 index 38444009d..000000000 --- a/doc/release/upcoming_changes/18906.new_function.rst +++ /dev/null @@ -1,17 +0,0 @@ -.. currentmodule:: numpy.random - -Add `PCG64DXSM` `BitGenerator` ------------------------------- - -Uses of the `PCG64` `BitGenerator` in a massively-parallel context have been -shown to have statistical weaknesses that were not apparent at the first -release in numpy 1.17. Most users will never observe this weakness and are -safe to continue to use `PCG64`. We have introduced a new `PCG64DXSM` -`BitGenerator` that will eventually become the new default `BitGenerator` -implementation used by `default_rng` in future releases. `PCG64DXSM` solves -the statistical weakness while preserving the performance and the features of -`PCG64`. - -See :ref:`upgrading-pcg64` for more details. - -.. currentmodule:: numpy diff --git a/doc/release/upcoming_changes/18934.improvement.rst b/doc/release/upcoming_changes/18934.improvement.rst deleted file mode 100644 index 582062f2f..000000000 --- a/doc/release/upcoming_changes/18934.improvement.rst +++ /dev/null @@ -1,5 +0,0 @@ -Placeholder annotations have been improved ------------------------------------------- -All placeholder annotations, that were previously annotated as ``typing.Any``, -have been improved. Where appropiate they have been replaced with explicit -function definitions, classes or other miscellaneous objects. diff --git a/doc/release/upcoming_changes/18935.new_feature.rst b/doc/release/upcoming_changes/18935.new_feature.rst deleted file mode 100644 index 8c6e25da6..000000000 --- a/doc/release/upcoming_changes/18935.new_feature.rst +++ /dev/null @@ -1,28 +0,0 @@ -A runtime-subcriptable alias has been added for `ndarray` ---------------------------------------------------------- -`numpy.typing.NDArray` has been added, a runtime-subscriptable alias for -``np.ndarray[Any, np.dtype[~Scalar]]``. The new type alias can be used -for annotating arrays with a given dtype and unspecified shape. :sup:`1` - -:sup:`1` NumPy does not support the annotating of array shapes as of 1.21, -this is expected to change in the future though (see :pep:`646`). - -Examples -~~~~~~~~ - -.. code-block:: python - - >>> import numpy as np - >>> import numpy.typing as npt - - >>> print(npt.NDArray) - numpy.ndarray[typing.Any, numpy.dtype[~ScalarType]] - - >>> print(npt.NDArray[np.float64]) - numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]] - - >>> NDArrayInt = npt.NDArray[np.int_] - >>> a: NDArrayInt = np.arange(10) - - >>> def func(a: npt.ArrayLike) -> npt.NDArray[Any]: - ... return np.array(a) diff --git a/doc/release/upcoming_changes/18963.expired.rst b/doc/release/upcoming_changes/18963.expired.rst deleted file mode 100644 index d93b8a06a..000000000 --- a/doc/release/upcoming_changes/18963.expired.rst +++ /dev/null @@ -1,8 +0,0 @@ -Remove deprecated ``PolyBase`` and unused ``PolyError`` and ``PolyDomainError`` -------------------------------------------------------------------------------- - -The class ``PolyBase`` has been removed (deprecated in numpy 1.9.0). Please use -the abstract ``ABCPolyBase`` class instead. - -Furthermore, the unused ``PolyError`` and ``PolyDomainError`` exceptions are -removed from the `numpy.polynomial`. diff --git a/doc/release/upcoming_changes/19001.deprecation.rst b/doc/release/upcoming_changes/19001.deprecation.rst deleted file mode 100644 index 48087f8a5..000000000 --- a/doc/release/upcoming_changes/19001.deprecation.rst +++ /dev/null @@ -1,8 +0,0 @@ -Exceptions will be raised during array-like creation ----------------------------------------------------- -When an object raised an exception during access of the special -attributes ``__array__`` or ``__array_interface__``, this exception -was usually ignored. -A warning is now given when the exception is anything but AttributeError. -To silence the warning, the type raising the exception has to be adapted -to raise an ``AttributeError``. diff --git a/doc/release/upcoming_changes/19031.deprecation.rst b/doc/release/upcoming_changes/19031.deprecation.rst deleted file mode 100644 index de92e18df..000000000 --- a/doc/release/upcoming_changes/19031.deprecation.rst +++ /dev/null @@ -1,12 +0,0 @@ -Four `ndarray.ctypes` methods have been deprecated --------------------------------------------------- -Four methods of the `ndarray.ctypes` object have been deprecated, -as they are (undocumentated) implementation artifacts of their respective -properties. - -The methods in question are: - -* ``_ctypes.get_data`` (use ``_ctypes.data`` instead) -* ``_ctypes.get_shape`` (use ``_ctypes.shape`` instead) -* ``_ctypes.get_strides`` (use ``_ctypes.strides`` instead) -* ``_ctypes.get_as_parameter`` (use ``_ctypes._as_parameter_`` instead) diff --git a/doc/release/upcoming_changes/19049.compatibility.rst b/doc/release/upcoming_changes/19049.compatibility.rst deleted file mode 100644 index 5a6eadc7a..000000000 --- a/doc/release/upcoming_changes/19049.compatibility.rst +++ /dev/null @@ -1,6 +0,0 @@ -Distutils forces strict floating point model on clang ------------------------------------------------------ -NumPy distutils will now always add the ``-ffp-exception-behavior=strict`` -compiler flag when compiling with clang. Clang defaults to a non-strict -version, which allows the compiler to generate code that does not set -floating point warnings/errors correctly. diff --git a/doc/source/_static/scipy-mathjax b/doc/source/_static/scipy-mathjax new file mode 160000 +Subproject 3d21c58225c09243d5a088b1557654d280925e0 diff --git a/doc/source/conf.py b/doc/source/conf.py index bf2fbdce9..5ba7f70b8 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -83,11 +83,9 @@ extensions = [ 'matplotlib.sphinxext.plot_directive', 'IPython.sphinxext.ipython_console_highlighting', 'IPython.sphinxext.ipython_directive', - 'sphinx.ext.imgmath', + 'sphinx.ext.mathjax', ] -imgmath_image_format = 'svg' - # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -188,6 +186,8 @@ if 'sphinx.ext.pngmath' in extensions: pngmath_use_preview = True pngmath_dvipng_args = ['-gamma', '1.5', '-D', '96', '-bg', 'Transparent'] +mathjax_path = "scipy-mathjax/MathJax.js?config=scipy-mathjax" + plot_html_show_formats = False plot_html_show_source_link = False diff --git a/doc/source/reference/arrays.scalars.rst b/doc/source/reference/arrays.scalars.rst index 6c9bcb504..abef66692 100644 --- a/doc/source/reference/arrays.scalars.rst +++ b/doc/source/reference/arrays.scalars.rst @@ -352,8 +352,8 @@ are also provided. uint32 uint64 - Alias for the unsigned integer types (one of `numpy.byte`, `numpy.short`, - `numpy.intc`, `numpy.int_` and `numpy.longlong`) with the specified number + Alias for the unsigned integer types (one of `numpy.ubyte`, `numpy.ushort`, + `numpy.uintc`, `numpy.uint` and `numpy.ulonglong`) with the specified number of bits. Compatible with the C99 ``uint8_t``, ``uint16_t``, ``uint32_t``, and @@ -371,8 +371,8 @@ are also provided. .. attribute:: uintp - Alias for the unsigned integer type (one of `numpy.byte`, `numpy.short`, - `numpy.intc`, `numpy.int_` and `np.longlong`) that is the same size as a + Alias for the unsigned integer type (one of `numpy.ubyte`, `numpy.ushort`, + `numpy.uintc`, `numpy.uint` and `np.ulonglong`) that is the same size as a pointer. Compatible with the C ``uintptr_t``. diff --git a/doc/source/release.rst b/doc/source/release.rst index 6d208d395..a2dece94b 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -5,6 +5,7 @@ Release Notes .. toctree:: :maxdepth: 3 + 1.22.0 <release/1.22.0-notes> 1.21.0 <release/1.21.0-notes> 1.20.3 <release/1.20.3-notes> 1.20.2 <release/1.20.2-notes> diff --git a/doc/source/release/1.21.0-notes.rst b/doc/source/release/1.21.0-notes.rst index 5fda1f631..ac65b8fd0 100644 --- a/doc/source/release/1.21.0-notes.rst +++ b/doc/source/release/1.21.0-notes.rst @@ -4,3 +4,563 @@ NumPy 1.21.0 Release Notes ========================== + +New functions +============= + +.. currentmodule:: numpy.random + +Add `PCG64DXSM` `BitGenerator` +------------------------------ + +Uses of the `PCG64` `BitGenerator` in a massively-parallel context have been +shown to have statistical weaknesses that were not apparent at the first +release in numpy 1.17. Most users will never observe this weakness and are +safe to continue to use `PCG64`. We have introduced a new `PCG64DXSM` +`BitGenerator` that will eventually become the new default `BitGenerator` +implementation used by `default_rng` in future releases. `PCG64DXSM` solves +the statistical weakness while preserving the performance and the features of +`PCG64`. + +See :ref:`upgrading-pcg64` for more details. + +.. currentmodule:: numpy + +(`gh-18906 <https://github.com/numpy/numpy/pull/18906>`__) + + +Deprecations +============ + +Inexact matches for `numpy.convolve` and `numpy.correlate` are deprecated +------------------------------------------------------------------------- + +`numpy.convolve` and `numpy.correlate` now emits a warning when there are case +insensitive and/or inexact matches found for ``mode`` argument in the functions. +Pass full ``"same"``, ``"valid"``, ``"full"`` strings instead of +``"s"``, ``"v"``, ``"f"`` for the ``mode`` argument. + +(`gh-17492 <https://github.com/numpy/numpy/pull/17492>`__) + +``np.typeDict`` has been formally deprecated +-------------------------------------------- +``np.typeDict`` is a deprecated alias for ``np.sctypeDict`` and +has been so for over 14 years (6689502_). +A deprecation warning will now be issued whenever getting ``np.typeDict``. + +.. _6689502: https://github.com/numpy/numpy/commit/668950285c407593a368336ff2e737c5da84af7d + +(`gh-17586 <https://github.com/numpy/numpy/pull/17586>`__) + +Exceptions will be raised during array-like creation +---------------------------------------------------- +When an object raised an exception during access of the special +attributes ``__array__`` or ``__array_interface__``, this exception +was usually ignored. +A warning is now given when the exception is anything but AttributeError. +To silence the warning, the type raising the exception has to be adapted +to raise an ``AttributeError``. + +(`gh-19001 <https://github.com/numpy/numpy/pull/19001>`__) + +Four `ndarray.ctypes` methods have been deprecated +-------------------------------------------------- +Four methods of the `ndarray.ctypes` object have been deprecated, +as they are (undocumentated) implementation artifacts of their respective +properties. + +The methods in question are: + +* ``_ctypes.get_data`` (use ``_ctypes.data`` instead) +* ``_ctypes.get_shape`` (use ``_ctypes.shape`` instead) +* ``_ctypes.get_strides`` (use ``_ctypes.strides`` instead) +* ``_ctypes.get_as_parameter`` (use ``_ctypes._as_parameter_`` instead) + +(`gh-19031 <https://github.com/numpy/numpy/pull/19031>`__) + + +Future Changes +============== + +Promotion of strings with numbers and bools is deprecated +--------------------------------------------------------- +Any promotion of numbers and strings is deprecated and will +give a ``FutureWarning`` the main affected functionalities +are: + +* `numpy.promote_types` and `numpy.result_type` which will raise + an error in this case in the future. +* `numpy.concatenate` will raise an error when concatenating a string + and numeric array. You can use ``dtype="S"`` to explicitly request + a string result. +* `numpy.array` and related functions will start returning ``object`` + arrays because these functions use ``object`` as a fallback when + no common dtype can be found. However, it may happen that future + releases of NumPy will generally error in these cases. + +This will mainly affect code such as:: + + np.asarray(['string', 0]) + +and:: + + np.concatenate((['string'], [0])) + +in both cases adding ``dtype="U"`` or ``dtype="S"`` will give the +previous (string) result, while ``dtype=object`` will ensure an array with +object dtype is returned. + +Comparisons, universal functions, and casting are not affected by this. + +(`gh-18116 <https://github.com/numpy/numpy/pull/18116>`__) + + +Expired deprecations +==================== + +* The ``shape`` argument `numpy.unravel_index` cannot be passed + as ``dims`` keyword argument anymore. (Was deprecated in NumPy 1.16.) + + (`gh-17900 <https://github.com/numpy/numpy/pull/17900>`__) + +* The function ``PyUFunc_GenericFunction`` has been disabled. + It was deprecated in NumPy 1.19. Users should call the ufunc + directly using the Python API. +* The function ``PyUFunc_SetUsesArraysAsData`` has been disabled. + It was deprecated in NumPy 1.19. + + (`gh-18697 <https://github.com/numpy/numpy/pull/18697>`__) + +Remove deprecated ``PolyBase`` and unused ``PolyError`` and ``PolyDomainError`` +------------------------------------------------------------------------------- + +The class ``PolyBase`` has been removed (deprecated in numpy 1.9.0). Please use +the abstract ``ABCPolyBase`` class instead. + +Furthermore, the unused ``PolyError`` and ``PolyDomainError`` exceptions are +removed from the `numpy.polynomial`. + +(`gh-18963 <https://github.com/numpy/numpy/pull/18963>`__) + + +Compatibility notes +=================== + +Error type changes in universal functions +----------------------------------------- +The universal functions may now raise different errors +on invalid input in some cases. +The main changes should be that a ``RuntimeError`` was +replaced with a more fitting ``TypeError``. +When multiple errors were present in the same call, +NumPy may now raise a different one. + + +``__array_ufunc__`` argument validation +--------------------------------------- +NumPy will now partially validate arguments before calling +``__array_ufunc__``. Previously, it was possible to pass +on invalid arguments (such as a non-existing keyword +argument) when dispatch was known to occur. + + +``__array_ufunc__`` and additional positional arguments +------------------------------------------------------- +Previously, all positionally passed arguments were checked for +``__array_ufunc__`` support. In the case of ``reduce``, +``accumulate``, and ``reduceat`` all arguments may be passed by +position. This means that when they were passed by +position, they could previously have been asked to handle +the ufunc call via ``__array_ufunc__``. +Since this depended on the way the arguments were passed +(by position or by keyword), NumPy will now only dispatch +on the input and output array. +For example, NumPy will never dispatch on the ``where`` array +in a reduction such as ``np.add.reduce``. + +(`gh-15271 <https://github.com/numpy/numpy/pull/15271>`__) + +Validate input values in ``Generator.uniform`` +---------------------------------------------- +Checked that ``high - low >= 0`` in ``np.random.Generator.uniform``. Raises +``ValueError`` if ``low > high``. Previously out-of-order inputs were accepted +and silently swapped, so that if ``low > high``, the value generated was +``high + (low - high) * random()``. + +(`gh-17921 <https://github.com/numpy/numpy/pull/17921>`__) + +``/usr/include`` removed from default include paths +--------------------------------------------------- +The default include paths when building a package with ``numpy.distutils`` no +longer include ``/usr/include``. This path is normally added by the compiler, +and hardcoding it can be problematic. In case this causes a problem, please +open an issue. A workaround is documented in PR 18658. + +(`gh-18658 <https://github.com/numpy/numpy/pull/18658>`__) + +Changes to comparisons with ``dtype=...`` +----------------------------------------- +When the ``dtype=`` (or ``signature``) arguments to comparison +ufuncs (``equal``, ``less``, etc.) is used, this will denote +the desired output dtype in the future. +This means that: + + np.equal(2, 3, dtype=object) + +will give a ``FutureWarning`` that it will return an ``object`` +array in the future, which currently happens for: + + np.equal(None, None, dtype=object) + +due to the fact that ``np.array(None)`` is already an object +array. (This also happens for some other dtypes.) + +Since comparisons normally only return boolean arrays, providing +any other dtype will always raise an error in the future and +give a ``DeprecationWarning`` now. + + +Changes to ``dtype`` and ``signature`` arguments in ufuncs +---------------------------------------------------------- +The universal function arguments ``dtype`` and ``signature`` +which are also valid for reduction such as ``np.add.reduce`` +(which is the implementation for ``np.sum``) will now issue +a warning when the ``dtype`` provided is not a "basic" dtype. + +NumPy almost always ignored metadata, byteorder or time units +on these inputs. NumPy will now always ignore it and raise an +error if byteorder or time unit changed. +The following are the most important examples of changes which +will give the error. In some cases previously the information +stored was not ignored, in all of these an error is now raised:: + + # Previously ignored the byte-order (affect if non-native) + np.add(3, 5, dtype=">i32") + + # The biggest impact is for timedelta or datetimes: + arr = np.arange(10, dtype="m8[s]") + # The examples always ignored the time unit "ns": + np.add(arr, arr, dtype="m8[ns]") + np.maximum.reduce(arr, dtype="m8[ns]") + + # The following previously did use "ns" (as opposed to `arr.dtype`) + np.add(3, 5, dtype="m8[ns]") # Now return generic time units + np.maximum(arr, arr, dtype="m8[ns]") # Now returns "s" (from `arr`) + +The same applies for functions like ``np.sum`` which use these internally. +This change is necessary to achieve consistent handling within NumPy. + +If you run into these, in most cases pass for example ``dtype=np.timedelta64`` +which clearly denotes a general ``timedelta64`` without any unit or byte-order +defined. If you need to specify the output dtype precisely, you may do so +by either casting the inputs or providing an output array using `out=`. + +NumPy may choose to allow providing an exact output ``dtype`` here in the +future, which would be preceded by a ``FutureWarning``. + +(`gh-18718 <https://github.com/numpy/numpy/pull/18718>`__) + +Ufunc ``signature=...`` and ``dtype=`` generalization and ``casting`` +--------------------------------------------------------------------- +The behaviour for ``np.ufunc(1.0, 1.0, signature=...)`` or +``np.ufunc(1.0, 1.0, dtype=...)`` can now yield different loops in 1.21 +compared to 1.20 because of changes in promotion. +When ``signature`` was previously used, the casting check on inputs +was relaxed, which could lead to downcasting inputs unsafely especially +if combined with ``casting="unsafe"``. + +Casting is now guaranteed to be safe. If a signature is only +partially provided, for example using ``signature=("float64", None, None)``, +this could lead to no loop being found (an error). +In that case, it is necessary to provide the complete signature +to enforce casting the inputs. +If ``dtype="float64"`` is used or only outputs are set (e.g. +``signature=(None, None, "float64")`` the is unchanged. +We expect that very few users are affected by this change. + +Further, the meaning of ``dtype="float64"`` has been slightly modified and +now strictly enforces only the correct output (and not input) DTypes. +This means it is now always equivalent to:: + + signature=(None, None, "float64") + +(If the ufunc has two inputs and one output). Since this could lead +to no loop being found in some cases, NumPy will normally also search +for the loop:: + + signature=("float64", "float64", "float64") + +if the first search failed. +In the future, this behaviour may be customized to achieve the expected +results for more complex ufuncs. (For some universal functions such as +``np.ldexp`` inputs can have different DTypes.) + +(`gh-18880 <https://github.com/numpy/numpy/pull/18880>`__) + +Distutils forces strict floating point model on clang +----------------------------------------------------- +NumPy distutils will now always add the ``-ffp-exception-behavior=strict`` +compiler flag when compiling with clang. Clang defaults to a non-strict +version, which allows the compiler to generate code that does not set +floating point warnings/errors correctly. + +(`gh-19049 <https://github.com/numpy/numpy/pull/19049>`__) + + +C API changes +============= + +Use of ``ufunc->type_resolver`` and "type tuple" +------------------------------------------------ +NumPy now normalizes the "type tuple" argument to the +type resolver functions before calling it. Note that in +the use of this type resolver is legacy behaviour and NumPy +will not do so when possible. +Calling ``ufunc->type_resolver`` or ``PyUFunc_DefaultTypeResolver`` +is strongly discouraged and will now enforce a normalized +type tuple if done. +Note that this does not affect providing a type resolver, which +is expected to keep working in most circumstances. +If you have an unexpected use-case for calling the type resolver, +please inform the NumPy developers so that a solution can be found. + +(`gh-18718 <https://github.com/numpy/numpy/pull/18718>`__) + + +New Features +============ + +Added a mypy plugin for handling platform-specific `numpy.number` precisions +---------------------------------------------------------------------------- + +A mypy_ plugin is now available for automatically assigning the (platform-dependent) +precisions of certain `~numpy.number` subclasses, including the likes of +`~numpy.int_`, `~numpy.intp` and `~numpy.longlong`. See the documentation on +:ref:`scalar types <arrays.scalars.built-in>` for a comprehensive overview +of the affected classes. + +Note that while usage of the plugin is completely optional, without it the +precision of above-mentioned classes will be inferred as `~typing.Any`. + +To enable the plugin, one must add it to their mypy `configuration file`_: + +.. code-block:: ini + + [mypy] + plugins = numpy.typing.mypy_plugin + + +.. _mypy: http://mypy-lang.org/ +.. _configuration file: https://mypy.readthedocs.io/en/stable/config_file.html + +(`gh-17843 <https://github.com/numpy/numpy/pull/17843>`__) + +Let the mypy plugin manage extended-precision `numpy.number` subclasses +----------------------------------------------------------------------- + +The mypy_ plugin, introduced in `numpy/numpy#17843`_, has been expanded: +the plugin now removes annotations for platform-specific extended-precision +types that are not available to the platform in question. +For example, it will remove `~numpy.float128` when not available. + +Without the plugin *all* extended-precision types will, as far as mypy is concerned, +be available on all platforms. + +To enable the plugin, one must add it to their mypy `configuration file`_: + +.. code-block:: ini + + [mypy] + plugins = numpy.typing.mypy_plugin + + +.. _mypy: http://mypy-lang.org/ +.. _configuration file: https://mypy.readthedocs.io/en/stable/config_file.html +.. _`numpy/numpy#17843`: https://github.com/numpy/numpy/pull/17843 + +(`gh-18322 <https://github.com/numpy/numpy/pull/18322>`__) + +New ``min_digits`` argument for printing float values +----------------------------------------------------- +A new ``min_digits`` argument has been added to the dragon4 float printing +functions `np.format_float_positional` and `np.format_float_scientific` . This +kwd guarantees that at least the given number of digits will be printed when +printing in unique=True mode, even if the extra digits are unnecessary to +uniquely specify the value. It is the counterpart to the precision argument +which sets the maximum number of digits to be printed. When unique=False in +fixed precision mode, it has no effect and the precision argument fixes the +number of digits. + +(`gh-18629 <https://github.com/numpy/numpy/pull/18629>`__) + +f2py now recognizes Fortran abstract interface blocks +----------------------------------------------------- +`np.f2py` can now parse abstract interface blocks. + +(`gh-18695 <https://github.com/numpy/numpy/pull/18695>`__) + +BLAS and LAPACK configuration via environment variables +------------------------------------------------------- +Autodetection of installed BLAS and LAPACK libraries can be bypassed by using +the ``NPY_BLAS_LIBS`` and ``NPY_LAPACK_LIBS`` environment variables. Instead, +the link flags in these environment variables will be used directly, and the +language is assumed to be F77. This is especially useful in automated builds +where the BLAS and LAPACK that are installed are known exactly. A use case is +replacing the actual implementation at runtime via stub library links. + +If ``NPY_CBLAS_LIBS`` is set (optional in addition to ``NPY_BLAS_LIBS``), this +will be used as well, by defining ``HAVE_CBLAS`` and appending the environment +variable content to the link flags. + +(`gh-18737 <https://github.com/numpy/numpy/pull/18737>`__) + +A runtime-subcriptable alias has been added for `ndarray` +--------------------------------------------------------- +`numpy.typing.NDArray` has been added, a runtime-subscriptable alias for +``np.ndarray[Any, np.dtype[~Scalar]]``. The new type alias can be used +for annotating arrays with a given dtype and unspecified shape. :sup:`1` + +:sup:`1` NumPy does not support the annotating of array shapes as of 1.21, +this is expected to change in the future though (see :pep:`646`). + +Examples +~~~~~~~~ + +.. code-block:: python + + >>> import numpy as np + >>> import numpy.typing as npt + + >>> print(npt.NDArray) + numpy.ndarray[typing.Any, numpy.dtype[~ScalarType]] + + >>> print(npt.NDArray[np.float64]) + numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]] + + >>> NDArrayInt = npt.NDArray[np.int_] + >>> a: NDArrayInt = np.arange(10) + + >>> def func(a: npt.ArrayLike) -> npt.NDArray[Any]: + ... return np.array(a) + +(`gh-18935 <https://github.com/numpy/numpy/pull/18935>`__) + + +Improvements +============ + +Arbitrary ``period`` option for `numpy.unwrap` +---------------------------------------------- +The size of the interval over which phases are unwrapped is no longer restricted to ``2 * pi``. +This is especially useful for unwrapping degrees, but can also be used for other intervals. + +.. code:: python + + >>> phase_deg = np.mod(np.linspace(0,720,19), 360) - 180 + >>> phase_deg + array([-180., -140., -100., -60., -20., 20., 60., 100., 140., + -180., -140., -100., -60., -20., 20., 60., 100., 140., + -180.]) + + >>> unwrap(phase_deg, period=360) + array([-180., -140., -100., -60., -20., 20., 60., 100., 140., + 180., 220., 260., 300., 340., 380., 420., 460., 500., + 540.]) + +(`gh-16987 <https://github.com/numpy/numpy/pull/16987>`__) + +``np.unique`` now returns single ``NaN`` +---------------------------------------- +When ``np.unique`` operated on an array with multiple ``NaN`` entries, +its return included a ``NaN`` for each entry that was ``NaN`` in the original array. +This is now improved such that the returned array contains just one ``NaN`` as the +last element. + +Also for complex arrays all ``NaN`` values are considered equivalent +(no matter whether the ``NaN`` is in the real or imaginary part). As the +representant for the returned array the smallest one in the +lexicographical order is chosen - see ``np.sort`` for how the lexicographical +order is defined for complex arrays. + +(`gh-18070 <https://github.com/numpy/numpy/pull/18070>`__) + +``Generator.rayleigh`` and ``Generator.geometric`` performance improved +----------------------------------------------------------------------- +The performance of Rayleigh and geometric random variate generation +in ``Generator`` has improved. These are both transformation of exponential +random variables and the slow log-based inverse cdf transformation has +been replaced with the Ziggurat-based exponential variate generator. + +This change breaks the stream of variates generated when variates from +either of these distributions are produced. + +(`gh-18666 <https://github.com/numpy/numpy/pull/18666>`__) + +Placeholder annotations have been improved +------------------------------------------ +All placeholder annotations, that were previously annotated as ``typing.Any``, +have been improved. Where appropiate they have been replaced with explicit +function definitions, classes or other miscellaneous objects. + +(`gh-18934 <https://github.com/numpy/numpy/pull/18934>`__) + + +Performance improvements and changes +==================================== + +Improved performance in integer division of NumPy arrays +-------------------------------------------------------- +Integer division of NumPy arrays now uses `libdivide <https://libdivide.com/>` +when the divisor is a constant. With the usage of libdivide and +other minor optimizations, there is a large speedup. +The ``//`` operator and ``np.floor_divide`` makes use +of the new changes. + +(`gh-17727 <https://github.com/numpy/numpy/pull/17727>`__) + +Improve performance of ``np.save`` and ``np.load`` for small arrays +------------------------------------------------------------------- +``np.save`` is now a lot faster for small arrays. + +``np.load`` is also faster for small arrays, +but only when serializing with a version >= `(3, 0)`. + +Both are done by removing checks that are only relevant for Python 2, +while still maintaining compatibility with arrays +which might have been created by Python 2. + +(`gh-18657 <https://github.com/numpy/numpy/pull/18657>`__) + + +Changes +======= + +`numpy.piecewise` output class now matches the input class +---------------------------------------------------------- +When `numpy.ndarray` subclasses are used on input to `numpy.piecewise`, +they are passed on to the functions. The output will now be of the +same subclass as well. + +(`gh-18110 <https://github.com/numpy/numpy/pull/18110>`__) + +Enable Accelerate Framework +---------------------------- +With the release of macOS 11.3, several different issues that +numpy was encountering when using Accelerate Framework's +implementation of BLAS and LAPACK should be resolved. This +change enables the Accelerate Framework as an option on macOS. +If additional issues are found, please file a bug report +against Accelerate using the developer feedback assistant +tool (https://developer.apple.com/bug-reporting/). We +intend to address issues promptly and plan to continue +supporting and updating our BLAS and LAPACK libraries. + +(`gh-18874 <https://github.com/numpy/numpy/pull/18874>`__) + + +.. currentmodule:: numpy + +========================== +NumPy 1.21.0 Release Notes +========================== + diff --git a/doc/source/release/1.22.0-notes.rst b/doc/source/release/1.22.0-notes.rst new file mode 100644 index 000000000..0760a3dd7 --- /dev/null +++ b/doc/source/release/1.22.0-notes.rst @@ -0,0 +1,45 @@ +.. currentmodule:: numpy + +========================== +NumPy 1.22.0 Release Notes +========================== + + +Highlights +========== + + +New functions +============= + + +Deprecations +============ + + +Future Changes +============== + + +Expired deprecations +==================== + + +Compatibility notes +=================== + + +C API changes +============= + + +New Features +============ + + +Improvements +============ + + +Changes +======= diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py index b8f0ee907..448f6a0c0 100644 --- a/numpy/core/_add_newdocs.py +++ b/numpy/core/_add_newdocs.py @@ -924,7 +924,7 @@ add_newdoc('numpy.core.multiarray', 'asarray', 'F' column-major (Fortran-style) memory representation. 'A' (any) means 'F' if `a` is Fortran contiguous, 'C' otherwise 'K' (keep) preserve input order - Defaults to 'C'. + Defaults to 'K'. ${ARRAY_FUNCTION_LIKE} .. versionadded:: 1.20.0 @@ -1536,6 +1536,10 @@ add_newdoc('numpy.core.multiarray', 'frombuffer', .. versionadded:: 1.20.0 + Returns + ------- + out : ndarray + Notes ----- If the buffer has data that is not in machine byte-order, this should diff --git a/numpy/core/code_generators/cversions.txt b/numpy/core/code_generators/cversions.txt index 2d3a65391..a02c7153a 100644 --- a/numpy/core/code_generators/cversions.txt +++ b/numpy/core/code_generators/cversions.txt @@ -55,4 +55,6 @@ # Version 14 (NumPy 1.20) # DType related API additions. # A new field was added to the end of PyArrayObject_fields. +# Version 14 (NumPy 1.21) No change. +# Version 14 (NumPy 1.22) No change. 0x0000000e = 17a0f366e55ec05e5c5c149123478452 diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py index ab1166ad2..e264fa210 100644 --- a/numpy/core/defchararray.py +++ b/numpy/core/defchararray.py @@ -16,7 +16,6 @@ The preferred alias for `defchararray` is `numpy.char`. """ import functools -import sys from .numerictypes import ( string_, unicode_, integer, int_, object_, bool_, character) from .numeric import ndarray, compare_chararrays diff --git a/numpy/core/include/numpy/numpyconfig.h b/numpy/core/include/numpy/numpyconfig.h index a1b1de0ef..726f1dfac 100644 --- a/numpy/core/include/numpy/numpyconfig.h +++ b/numpy/core/include/numpy/numpyconfig.h @@ -43,5 +43,6 @@ #define NPY_1_19_API_VERSION 0x00000008 #define NPY_1_20_API_VERSION 0x0000000e #define NPY_1_21_API_VERSION 0x0000000e +#define NPY_1_22_API_VERSION 0x0000000e #endif diff --git a/numpy/core/numeric.pyi b/numpy/core/numeric.pyi index 6b9ef4b20..f57951434 100644 --- a/numpy/core/numeric.pyi +++ b/numpy/core/numeric.pyi @@ -238,6 +238,6 @@ def isclose( equal_nan: bool = ..., ) -> Any: ... -def array_equal(a1: ArrayLike, a2: ArrayLike) -> bool: ... +def array_equal(a1: ArrayLike, a2: ArrayLike, equal_nan: bool = ...) -> bool: ... def array_equiv(a1: ArrayLike, a2: ArrayLike) -> bool: ... diff --git a/numpy/core/records.py b/numpy/core/records.py index 5bd13a698..b3474ad01 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -33,7 +33,6 @@ Record arrays allow us to access fields as properties:: array([2., 2.]) """ -import os import warnings from collections import Counter from contextlib import nullcontext diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index fe66bd173..85c8f16d1 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -42,6 +42,8 @@ C_ABI_VERSION = 0x01000009 # 0x0000000d - 1.16.x # 0x0000000d - 1.19.x # 0x0000000e - 1.20.x +# 0x0000000e - 1.21.x +# 0x0000000e - 1.22.x C_API_VERSION = 0x0000000e class MismatchCAPIWarning(Warning): diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py index ae1e6a180..47d07ad4a 100644 --- a/numpy/distutils/ccompiler_opt.py +++ b/numpy/distutils/ccompiler_opt.py @@ -552,7 +552,7 @@ class _Distutils: ccompiler = self._ccompiler return ccompiler.compile(sources, extra_postargs=flags, **kwargs) - def dist_test(self, source, flags): + def dist_test(self, source, flags, macros=[]): """Return True if 'CCompiler.compile()' able to compile a source file with certain flags. """ @@ -569,7 +569,7 @@ class _Distutils: test = False try: self.dist_compile( - [source], flags, output_dir=self.conf_tmp_path + [source], flags, macros=macros, output_dir=self.conf_tmp_path ) test = True except CompileError as e: @@ -1172,20 +1172,23 @@ class _Feature: self.feature_is_cached = True - def feature_names(self, names=None, force_flags=None): + def feature_names(self, names=None, force_flags=None, macros=[]): """ Returns a set of CPU feature names that supported by platform and the **C** compiler. Parameters ---------- - 'names': sequence or None, optional + names: sequence or None, optional Specify certain CPU features to test it against the **C** compiler. if None(default), it will test all current supported features. **Note**: feature names must be in upper-case. - 'force_flags': list or None, optional - If None(default), default compiler flags for every CPU feature will be used - during the test. + force_flags: list or None, optional + If None(default), default compiler flags for every CPU feature will + be used during the test. + + macros : list of tuples, optional + A list of C macro definitions. """ assert( names is None or ( @@ -1198,7 +1201,9 @@ class _Feature: names = self.feature_supported.keys() supported_names = set() for f in names: - if self.feature_is_supported(f, force_flags=force_flags): + if self.feature_is_supported( + f, force_flags=force_flags, macros=macros + ): supported_names.add(f) return supported_names @@ -1433,20 +1438,23 @@ class _Feature: return self.cc_normalize_flags(flags) @_Cache.me - def feature_test(self, name, force_flags=None): + def feature_test(self, name, force_flags=None, macros=[]): """ Test a certain CPU feature against the compiler through its own check file. Parameters ---------- - 'name': str + name: str Supported CPU feature name. - 'force_flags': list or None, optional + force_flags: list or None, optional If None(default), the returned flags from `feature_flags()` will be used. - """ + + macros : list of tuples, optional + A list of C macro definitions. + """ if force_flags is None: force_flags = self.feature_flags(name) @@ -1462,24 +1470,29 @@ class _Feature: if not os.path.exists(test_path): self.dist_fatal("feature test file is not exist", test_path) - test = self.dist_test(test_path, force_flags + self.cc_flags["werror"]) + test = self.dist_test( + test_path, force_flags + self.cc_flags["werror"], macros=macros + ) if not test: self.dist_log("testing failed", stderr=True) return test @_Cache.me - def feature_is_supported(self, name, force_flags=None): + def feature_is_supported(self, name, force_flags=None, macros=[]): """ Check if a certain CPU feature is supported by the platform and compiler. Parameters ---------- - 'name': str + name: str CPU feature name in uppercase. - 'force_flags': list or None, optional - If None(default), default compiler flags for every CPU feature will be used - during test. + force_flags: list or None, optional + If None(default), default compiler flags for every CPU feature will + be used during test. + + macros : list of tuples, optional + A list of C macro definitions. """ assert(name.isupper()) assert(force_flags is None or isinstance(force_flags, list)) @@ -1487,9 +1500,9 @@ class _Feature: supported = name in self.feature_supported if supported: for impl in self.feature_implies(name): - if not self.feature_test(impl, force_flags): + if not self.feature_test(impl, force_flags, macros=macros): return False - if not self.feature_test(name, force_flags): + if not self.feature_test(name, force_flags, macros=macros): return False return supported @@ -1812,7 +1825,9 @@ class _Parse: self.dist_fatal(arg_name, "native option isn't supported by the compiler" ) - features_to = self.feature_names(force_flags=native) + features_to = self.feature_names( + force_flags=native, macros=[("DETECT_FEATURES", 1)] + ) elif TOK == "MAX": features_to = self.feature_supported.keys() elif TOK == "MIN": diff --git a/numpy/distutils/checks/cpu_avx.c b/numpy/distutils/checks/cpu_avx.c index cee4f36ab..26ae18466 100644 --- a/numpy/distutils/checks/cpu_avx.c +++ b/numpy/distutils/checks/cpu_avx.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __AVX__ + #error "HOST/ARCH doesn't support AVX" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx2.c b/numpy/distutils/checks/cpu_avx2.c index 15b6c919b..ddde868f1 100644 --- a/numpy/distutils/checks/cpu_avx2.c +++ b/numpy/distutils/checks/cpu_avx2.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __AVX2__ + #error "HOST/ARCH doesn't support AVX2" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx512_clx.c b/numpy/distutils/checks/cpu_avx512_clx.c index 4baa8fea0..81edcd067 100644 --- a/numpy/distutils/checks/cpu_avx512_clx.c +++ b/numpy/distutils/checks/cpu_avx512_clx.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __AVX512VNNI__ + #error "HOST/ARCH doesn't support CascadeLake AVX512 features" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx512_cnl.c b/numpy/distutils/checks/cpu_avx512_cnl.c index f2ff3725e..5799f122b 100644 --- a/numpy/distutils/checks/cpu_avx512_cnl.c +++ b/numpy/distutils/checks/cpu_avx512_cnl.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #if !defined(__AVX512VBMI__) || !defined(__AVX512IFMA__) + #error "HOST/ARCH doesn't support CannonLake AVX512 features" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx512_icl.c b/numpy/distutils/checks/cpu_avx512_icl.c index 085b947e0..3cf44d731 100644 --- a/numpy/distutils/checks/cpu_avx512_icl.c +++ b/numpy/distutils/checks/cpu_avx512_icl.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #if !defined(__AVX512VPOPCNTDQ__) || !defined(__AVX512BITALG__) || !defined(__AVX512VPOPCNTDQ__) + #error "HOST/ARCH doesn't support IceLake AVX512 features" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx512_knl.c b/numpy/distutils/checks/cpu_avx512_knl.c index 10ba52bcc..b3f4f6976 100644 --- a/numpy/distutils/checks/cpu_avx512_knl.c +++ b/numpy/distutils/checks/cpu_avx512_knl.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #if !defined(__AVX512ER__) || !defined(__AVX512PF__) + #error "HOST/ARCH doesn't support Knights Landing AVX512 features" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx512_knm.c b/numpy/distutils/checks/cpu_avx512_knm.c index d03b0fe8b..2c426462b 100644 --- a/numpy/distutils/checks/cpu_avx512_knm.c +++ b/numpy/distutils/checks/cpu_avx512_knm.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #if !defined(__AVX5124FMAPS__) || !defined(__AVX5124VNNIW__) || !defined(__AVX512VPOPCNTDQ__) + #error "HOST/ARCH doesn't support Knights Mill AVX512 features" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx512_skx.c b/numpy/distutils/checks/cpu_avx512_skx.c index 047618762..8840efb7e 100644 --- a/numpy/distutils/checks/cpu_avx512_skx.c +++ b/numpy/distutils/checks/cpu_avx512_skx.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #if !defined(__AVX512VL__) || !defined(__AVX512BW__) || !defined(__AVX512DQ__) + #error "HOST/ARCH doesn't support SkyLake AVX512 features" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx512cd.c b/numpy/distutils/checks/cpu_avx512cd.c index 52f4c7f8b..5e29c79e3 100644 --- a/numpy/distutils/checks/cpu_avx512cd.c +++ b/numpy/distutils/checks/cpu_avx512cd.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __AVX512CD__ + #error "HOST/ARCH doesn't support AVX512CD" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_avx512f.c b/numpy/distutils/checks/cpu_avx512f.c index 22d861471..d0eb7b1ad 100644 --- a/numpy/distutils/checks/cpu_avx512f.c +++ b/numpy/distutils/checks/cpu_avx512f.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __AVX512F__ + #error "HOST/ARCH doesn't support AVX512F" + #endif +#endif + #include <immintrin.h> int main(int argc, char **argv) diff --git a/numpy/distutils/checks/cpu_f16c.c b/numpy/distutils/checks/cpu_f16c.c index 678c582e4..fdf36cec5 100644 --- a/numpy/distutils/checks/cpu_f16c.c +++ b/numpy/distutils/checks/cpu_f16c.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __F16C__ + #error "HOST/ARCH doesn't support F16C" + #endif +#endif + #include <emmintrin.h> #include <immintrin.h> diff --git a/numpy/distutils/checks/cpu_fma3.c b/numpy/distutils/checks/cpu_fma3.c index 2f879c3b3..bfeef22b5 100644 --- a/numpy/distutils/checks/cpu_fma3.c +++ b/numpy/distutils/checks/cpu_fma3.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #if !defined(__FMA__) && !defined(__AVX2__) + #error "HOST/ARCH doesn't support FMA3" + #endif +#endif + #include <xmmintrin.h> #include <immintrin.h> diff --git a/numpy/distutils/checks/cpu_popcnt.c b/numpy/distutils/checks/cpu_popcnt.c index e6a80fb40..813c461f0 100644 --- a/numpy/distutils/checks/cpu_popcnt.c +++ b/numpy/distutils/checks/cpu_popcnt.c @@ -1,23 +1,32 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env vr `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #if !defined(__SSE4_2__) && !defined(__POPCNT__) + #error "HOST/ARCH doesn't support POPCNT" + #endif +#endif + #ifdef _MSC_VER #include <nmmintrin.h> #else #include <popcntintrin.h> #endif -int main(void) +int main(int argc, char **argv) { - long long a = 0; - int b; -#ifdef _MSC_VER - #ifdef _M_X64 - a = _mm_popcnt_u64(1); - #endif - b = _mm_popcnt_u32(1); -#else - #ifdef __x86_64__ - a = __builtin_popcountll(1); - #endif - b = __builtin_popcount(1); + // To make sure popcnt instructions are generated + // and been tested against the assembler + unsigned long long a = *((unsigned long long*)argv[argc-1]); + unsigned int b = *((unsigned int*)argv[argc-2]); + +#if defined(_M_X64) || defined(__x86_64__) + a = _mm_popcnt_u64(a); #endif + b = _mm_popcnt_u32(b); return (int)a + b; } diff --git a/numpy/distutils/checks/cpu_sse.c b/numpy/distutils/checks/cpu_sse.c index bb98bf63c..602b74e7b 100644 --- a/numpy/distutils/checks/cpu_sse.c +++ b/numpy/distutils/checks/cpu_sse.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __SSE__ + #error "HOST/ARCH doesn't support SSE" + #endif +#endif + #include <xmmintrin.h> int main(void) diff --git a/numpy/distutils/checks/cpu_sse2.c b/numpy/distutils/checks/cpu_sse2.c index 658afc9b4..33826a9ed 100644 --- a/numpy/distutils/checks/cpu_sse2.c +++ b/numpy/distutils/checks/cpu_sse2.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __SSE2__ + #error "HOST/ARCH doesn't support SSE2" + #endif +#endif + #include <emmintrin.h> int main(void) diff --git a/numpy/distutils/checks/cpu_sse3.c b/numpy/distutils/checks/cpu_sse3.c index aece1e601..d47c20f74 100644 --- a/numpy/distutils/checks/cpu_sse3.c +++ b/numpy/distutils/checks/cpu_sse3.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __SSE3__ + #error "HOST/ARCH doesn't support SSE3" + #endif +#endif + #include <pmmintrin.h> int main(void) diff --git a/numpy/distutils/checks/cpu_sse41.c b/numpy/distutils/checks/cpu_sse41.c index bfdb9feac..7c80238a3 100644 --- a/numpy/distutils/checks/cpu_sse41.c +++ b/numpy/distutils/checks/cpu_sse41.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __SSE4_1__ + #error "HOST/ARCH doesn't support SSE41" + #endif +#endif + #include <smmintrin.h> int main(void) diff --git a/numpy/distutils/checks/cpu_sse42.c b/numpy/distutils/checks/cpu_sse42.c index 24f5d93fe..f60e18f3c 100644 --- a/numpy/distutils/checks/cpu_sse42.c +++ b/numpy/distutils/checks/cpu_sse42.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __SSE4_2__ + #error "HOST/ARCH doesn't support SSE42" + #endif +#endif + #include <smmintrin.h> int main(void) diff --git a/numpy/distutils/checks/cpu_ssse3.c b/numpy/distutils/checks/cpu_ssse3.c index ad0abc1e6..fde390d6a 100644 --- a/numpy/distutils/checks/cpu_ssse3.c +++ b/numpy/distutils/checks/cpu_ssse3.c @@ -1,3 +1,16 @@ +#if defined(DETECT_FEATURES) && defined(__INTEL_COMPILER) + /* + * Unlike GCC and CLANG, Intel Compiler exposes all supported intrinsics, + * whether or not the build options for those features are specified. + * Therefore, we must test #definitions of CPU features when option native/host + * is enabled via `--cpu-baseline` or through env var `CFLAGS` otherwise + * the test will be broken and leads to enable all possible features. + */ + #ifndef __SSSE3__ + #error "HOST/ARCH doesn't support SSSE3" + #endif +#endif + #include <tmmintrin.h> int main(void) diff --git a/numpy/distutils/fcompiler/nv.py b/numpy/distutils/fcompiler/nv.py index 8e9f16835..212f34806 100644 --- a/numpy/distutils/fcompiler/nv.py +++ b/numpy/distutils/fcompiler/nv.py @@ -1,5 +1,3 @@ -import sys - from numpy.distutils.fcompiler import FCompiler compilers = ['NVHPCFCompiler'] diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index f403a66b5..60685be8a 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -469,7 +469,7 @@ cppmacros['MEMCOPY'] = """\ """ cppmacros['STRINGMALLOC'] = """\ #define STRINGMALLOC(str,len)\\ - if ((str = (string)malloc(sizeof(char)*(len+1))) == NULL) {\\ + if ((str = (string)malloc(len+1)) == NULL) {\\ PyErr_SetString(PyExc_MemoryError, \"out of memory\");\\ goto capi_fail;\\ } else {\\ @@ -481,18 +481,18 @@ cppmacros['STRINGFREE'] = """\ """ needs['STRINGCOPYN'] = ['string.h', 'FAILNULL'] cppmacros['STRINGCOPYN'] = """\ -#define STRINGCOPYN(to,from,buf_size) \\ +/* +STRINGCOPYN copies N bytes. + +`to` and `from` buffers must have sizes of at least N bytes. +*/ +#define STRINGCOPYN(to,from,N) \\ do { \\ - int _m = (buf_size); \\ + int _m = (N); \\ char *_to = (to); \\ char *_from = (from); \\ FAILNULL(_to); FAILNULL(_from); \\ - (void)strncpy(_to, _from, sizeof(char)*_m); \\ - _to[_m-1] = '\\0'; \\ - /* Padding with spaces instead of nulls */ \\ - for (_m -= 2; _m >= 0 && _to[_m] == '\\0'; _m--) { \\ - _to[_m] = ' '; \\ - } \\ + (void)strncpy(_to, _from, _m); \\ } while (0) """ needs['STRINGCOPY'] = ['string.h', 'FAILNULL'] @@ -623,71 +623,121 @@ static int *nextforcomb(void) { }""" needs['try_pyarr_from_string'] = ['STRINGCOPYN', 'PRINTPYOBJERR', 'string'] cfuncs['try_pyarr_from_string'] = """\ -static int try_pyarr_from_string(PyObject *obj,const string str) { - PyArrayObject *arr = NULL; - if (PyArray_Check(obj) && (!((arr = (PyArrayObject *)obj) == NULL))) - { STRINGCOPYN(PyArray_DATA(arr),str,PyArray_NBYTES(arr)); } - return 1; +/* + try_pyarr_from_string copies str[:len(obj)] to the data of an `ndarray`. + + If obj is an `ndarray`, it is assumed to be contiguous. + + If the specified len==-1, str must be null-terminated. +*/ +static int try_pyarr_from_string(PyObject *obj, + const string str, const int len) { +#ifdef DEBUGCFUNCS +fprintf(stderr, "try_pyarr_from_string(str='%s', len=%d, obj=%p)\\n", + (char*)str,len, obj); +#endif + if (PyArray_Check(obj)) { + PyArrayObject *arr = (PyArrayObject *)obj; + assert(ISCONTIGUOUS(arr)); + string buf = PyArray_DATA(arr); + npy_intp n = len; + if (n == -1) { + /* Assuming null-terminated str. */ + n = strlen(str); + } + if (n > PyArray_NBYTES(arr)) { + n = PyArray_NBYTES(arr); + } + STRINGCOPYN(buf, str, n); + return 1; + } capi_fail: PRINTPYOBJERR(obj); - PyErr_SetString(#modulename#_error,\"try_pyarr_from_string failed\"); + PyErr_SetString(#modulename#_error, \"try_pyarr_from_string failed\"); return 0; } """ needs['string_from_pyobj'] = ['string', 'STRINGMALLOC', 'STRINGCOPYN'] cfuncs['string_from_pyobj'] = """\ +/* + Create a new string buffer `str` of at most length `len` from a + Python string-like object `obj`. + + The string buffer has given size (len) or the size of inistr when len==-1. + + The string buffer is null-terminated. + */ static int -string_from_pyobj(string *str,int *len,const string inistr,PyObject *obj,const char *errmess) +string_from_pyobj(string *str, int *len, const string inistr, PyObject *obj, + const char *errmess) { - PyArrayObject *arr = NULL; PyObject *tmp = NULL; + string buf = NULL; + npy_intp n = -1; #ifdef DEBUGCFUNCS -fprintf(stderr,\"string_from_pyobj(str='%s',len=%d,inistr='%s',obj=%p)\\n\",(char*)str,*len,(char *)inistr,obj); +fprintf(stderr,\"string_from_pyobj(str='%s',len=%d,inistr='%s',obj=%p)\\n\", + (char*)str, *len, (char *)inistr, obj); #endif if (obj == Py_None) { - if (*len == -1) - *len = strlen(inistr); /* Will this cause problems? */ - STRINGMALLOC(*str,*len); - STRINGCOPYN(*str,inistr,*len+1); - return 1; + n = strlen(inistr); + buf = inistr; } - if (PyArray_Check(obj)) { - if ((arr = (PyArrayObject *)obj) == NULL) - goto capi_fail; + else if (PyArray_Check(obj)) { + PyArrayObject *arr = (PyArrayObject *)obj; if (!ISCONTIGUOUS(arr)) { - PyErr_SetString(PyExc_ValueError,\"array object is non-contiguous.\"); + PyErr_SetString(PyExc_ValueError, + \"array object is non-contiguous.\"); goto capi_fail; } - if (*len == -1) - *len = (PyArray_ITEMSIZE(arr))*PyArray_SIZE(arr); - STRINGMALLOC(*str,*len); - STRINGCOPYN(*str,PyArray_DATA(arr),*len+1); - return 1; - } - if (PyBytes_Check(obj)) { - tmp = obj; - Py_INCREF(tmp); - } - else if (PyUnicode_Check(obj)) { - tmp = PyUnicode_AsASCIIString(obj); + n = PyArray_NBYTES(arr); + buf = PyArray_DATA(arr); } else { - PyObject *tmp2; - tmp2 = PyObject_Str(obj); - if (tmp2) { - tmp = PyUnicode_AsASCIIString(tmp2); - Py_DECREF(tmp2); + if (PyBytes_Check(obj)) { + tmp = obj; + Py_INCREF(tmp); + } + else if (PyUnicode_Check(obj)) { + tmp = PyUnicode_AsASCIIString(obj); } else { - tmp = NULL; + PyObject *tmp2; + tmp2 = PyObject_Str(obj); + if (tmp2) { + tmp = PyUnicode_AsASCIIString(tmp2); + Py_DECREF(tmp2); + } + else { + tmp = NULL; + } } + if (tmp == NULL) goto capi_fail; + n = PyBytes_GET_SIZE(tmp); + buf = PyBytes_AS_STRING(tmp); } - if (tmp == NULL) goto capi_fail; - if (*len == -1) - *len = PyBytes_GET_SIZE(tmp); - STRINGMALLOC(*str,*len); - STRINGCOPYN(*str,PyBytes_AS_STRING(tmp),*len+1); - Py_DECREF(tmp); + if (*len == -1) { + /* TODO: change the type of `len` so that we can remove this */ + if (n > NPY_MAX_INT) { + PyErr_SetString(PyExc_OverflowError, + "object too large for a 32-bit int"); + goto capi_fail; + } + *len = n; + } + else if (*len < n) { + /* discard the last (len-n) bytes of input buf */ + n = *len; + } + if (n < 0 || *len < 0 || buf == NULL) { + goto capi_fail; + } + STRINGMALLOC(*str, *len); // *str is allocated with size (*len + 1) + if (n < *len) { + /* Pad fixed-width string with nulls */ + memset(*str + n, '\\0', *len - n); + } + STRINGCOPYN(*str, buf, n); + Py_XDECREF(tmp); return 1; capi_fail: Py_XDECREF(tmp); @@ -702,7 +752,6 @@ capi_fail: } """ - needs['char_from_pyobj'] = ['int_from_pyobj'] cfuncs['char_from_pyobj'] = """\ static int diff --git a/numpy/f2py/crackfortran.py b/numpy/f2py/crackfortran.py index 6453bbecb..984bd642b 100755 --- a/numpy/f2py/crackfortran.py +++ b/numpy/f2py/crackfortran.py @@ -139,7 +139,6 @@ TODO: The above may be solved by creating appropriate preprocessor program, for example. """ -import io import sys import string import fileinput diff --git a/numpy/f2py/rules.py b/numpy/f2py/rules.py index 63e47baa2..f01b2bcfa 100755 --- a/numpy/f2py/rules.py +++ b/numpy/f2py/rules.py @@ -561,7 +561,8 @@ rout_rules = [ '\tint #name#_return_value_len = 0;'], 'callfortran':'#name#_return_value,#name#_return_value_len,', 'callfortranroutine':['\t#name#_return_value_len = #rlength#;', - '\tif ((#name#_return_value = (string)malloc(sizeof(char)*(#name#_return_value_len+1))) == NULL) {', + '\tif ((#name#_return_value = (string)malloc(' + '#name#_return_value_len+1) == NULL) {', '\t\tPyErr_SetString(PyExc_MemoryError, \"out of memory\");', '\t\tf2py_success = 0;', '\t} else {', @@ -963,7 +964,8 @@ if (#varname#_cb.capi==Py_None) { 'args_capi': {isrequired: ',&#varname#_capi'}, 'keys_capi': {isoptional: ',&#varname#_capi'}, 'pyobjfrom': {isintent_inout: '''\ -\tf2py_success = try_pyarr_from_#ctype#(#varname#_capi,#varname#); +\tf2py_success = try_pyarr_from_#ctype#(#varname#_capi, #varname#, +\t slen(#varname#)); \tif (f2py_success) {'''}, 'closepyobjfrom': {isintent_inout: '\t} /*if (f2py_success) of #varname# pyobjfrom*/'}, 'need': {isintent_inout: 'try_pyarr_from_#ctype#'}, diff --git a/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c b/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c index 0411b62e0..fe21d4b9b 100644 --- a/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c +++ b/numpy/f2py/tests/src/array_from_pyobj/wrapmodule.c @@ -93,7 +93,7 @@ static PyObject *f2py_rout_wrap_attrs(PyObject *capi_self, PyObject *strides = NULL; char s[100]; int i; - memset(s,0,100*sizeof(char)); + memset(s,0,100); if (!PyArg_ParseTuple(capi_args,"O!|:wrap.attrs", &PyArray_Type,&arr_capi)) return NULL; diff --git a/numpy/f2py/tests/test_return_character.py b/numpy/f2py/tests/test_return_character.py index 429e69bb4..dc524e60c 100644 --- a/numpy/f2py/tests/test_return_character.py +++ b/numpy/f2py/tests/test_return_character.py @@ -24,8 +24,8 @@ class TestReturnCharacter(util.F2PyTest): assert_(t(23) == b'23 ', repr(t(23))) assert_(t('123456789abcdef') == b'123456789a') elif tname in ['t5', 's5']: - assert_(t(23) == b'23 ', repr(t(23))) - assert_(t('ab') == b'ab ', repr(t('ab'))) + assert_(t(23) == b'23', repr(t(23))) + assert_(t('ab') == b'ab', repr(t('ab'))) assert_(t('123456789abcdef') == b'12345') else: raise NotImplementedError diff --git a/numpy/f2py/tests/test_string.py b/numpy/f2py/tests/test_string.py index e3ec96af9..1530c58f6 100644 --- a/numpy/f2py/tests/test_string.py +++ b/numpy/f2py/tests/test_string.py @@ -1,6 +1,6 @@ import os import pytest - +import textwrap from numpy.testing import assert_array_equal import numpy as np from . import util @@ -9,14 +9,156 @@ from . import util def _path(*a): return os.path.join(*((os.path.dirname(__file__),) + a)) + class TestString(util.F2PyTest): sources = [_path('src', 'string', 'char.f90')] @pytest.mark.slow def test_char(self): strings = np.array(['ab', 'cd', 'ef'], dtype='c').T - inp, out = self.module.char_test.change_strings(strings, strings.shape[1]) + inp, out = self.module.char_test.change_strings(strings, + strings.shape[1]) assert_array_equal(inp, strings) expected = strings.copy() expected[1, :] = 'AAA' assert_array_equal(out, expected) + + +class TestDocStringArguments(util.F2PyTest): + suffix = '.f' + + code = """ +C FILE: STRING.F + SUBROUTINE FOO(A,B,C,D) + CHARACTER*5 A, B + CHARACTER*(*) C,D +Cf2py intent(in) a,c +Cf2py intent(inout) b,d + PRINT*, "A=",A + PRINT*, "B=",B + PRINT*, "C=",C + PRINT*, "D=",D + PRINT*, "CHANGE A,B,C,D" + A(1:1) = 'A' + B(1:1) = 'B' + C(1:1) = 'C' + D(1:1) = 'D' + PRINT*, "A=",A + PRINT*, "B=",B + PRINT*, "C=",C + PRINT*, "D=",D + END +C END OF FILE STRING.F + """ + + def test_example(self): + a = np.array(b'123\0\0') + b = np.array(b'123\0\0') + c = np.array(b'123') + d = np.array(b'123') + + self.module.foo(a, b, c, d) + + assert a.tobytes() == b'123\0\0' + assert b.tobytes() == b'B23\0\0', (b.tobytes(),) + assert c.tobytes() == b'123' + assert d.tobytes() == b'D23' + + +class TestFixedString(util.F2PyTest): + suffix = '.f90' + + code = textwrap.dedent(""" + function sint(s) result(i) + implicit none + character(len=*) :: s + integer :: j, i + i = 0 + do j=1, len(s) + i = i + ichar(s(j:j)) * 10 ** (j - 1) + end do + return + end function sint + + function test_in_bytes4(a) result (i) + implicit none + integer :: sint + character(len=4) :: a + integer :: i + i = sint(a) + a(1:1) = 'A' + return + end function test_in_bytes4 + + function test_inout_bytes4(a) result (i) + implicit none + integer :: sint + character(len=4), intent(inout) :: a + integer :: i + if (ichar(a(1:1)).ne.0) then + a(1:1) = 'E' + endif + i = sint(a) + return + end function test_inout_bytes4 + """) + + @staticmethod + def _sint(s, start=0, end=None): + """Return the content of a string buffer as integer value. + + For example: + _sint('1234') -> 4321 + _sint('123A') -> 17321 + """ + if isinstance(s, np.ndarray): + s = s.tobytes() + elif isinstance(s, str): + s = s.encode() + assert isinstance(s, bytes) + if end is None: + end = len(s) + i = 0 + for j in range(start, min(end, len(s))): + i += s[j] * 10 ** j + return i + + def _get_input(self, intent='in'): + if intent in ['in']: + yield '' + yield '1' + yield '1234' + yield '12345' + yield b'' + yield b'\0' + yield b'1' + yield b'\01' + yield b'1\0' + yield b'1234' + yield b'12345' + yield np.ndarray((), np.bytes_, buffer=b'') # array(b'', dtype='|S0') + yield np.array(b'') # array(b'', dtype='|S1') + yield np.array(b'\0') + yield np.array(b'1') + yield np.array(b'1\0') + yield np.array(b'\01') + yield np.array(b'1234') + yield np.array(b'123\0') + yield np.array(b'12345') + + def test_intent_in(self): + for s in self._get_input(): + r = self.module.test_in_bytes4(s) + # also checks that s is not changed inplace + expected = self._sint(s, end=4) + assert r == expected, (s) + + def test_intent_inout(self): + for s in self._get_input(intent='inout'): + rest = self._sint(s, start=4) + r = self.module.test_inout_bytes4(s) + expected = self._sint(s, end=4) + assert r == expected + + # check that the rest of input string is preserved + assert rest == self._sint(s, start=4) diff --git a/numpy/lib/nanfunctions.py b/numpy/lib/nanfunctions.py index a02ad779f..2c2c3435b 100644 --- a/numpy/lib/nanfunctions.py +++ b/numpy/lib/nanfunctions.py @@ -962,12 +962,16 @@ def _nanmedian1d(arr1d, overwrite_input=False): Private function for rank 1 arrays. Compute the median ignoring NaNs. See nanmedian for parameter usage """ - arr1d, overwrite_input = _remove_nan_1d(arr1d, - overwrite_input=overwrite_input) - if arr1d.size == 0: - return np.nan + arr1d_parsed, overwrite_input = _remove_nan_1d( + arr1d, overwrite_input=overwrite_input, + ) - return np.median(arr1d, overwrite_input=overwrite_input) + if arr1d_parsed.size == 0: + # Ensure that a nan-esque scalar of the appropiate type (and unit) + # is returned for `timedelta64` and `complexfloating` + return arr1d[-1] + + return np.median(arr1d_parsed, overwrite_input=overwrite_input) def _nanmedian(a, axis=None, out=None, overwrite_input=False): @@ -1008,10 +1012,12 @@ def _nanmedian_small(a, axis=None, out=None, overwrite_input=False): for i in range(np.count_nonzero(m.mask.ravel())): warnings.warn("All-NaN slice encountered", RuntimeWarning, stacklevel=4) + + fill_value = np.timedelta64("NaT") if m.dtype.kind == "m" else np.nan if out is not None: - out[...] = m.filled(np.nan) + out[...] = m.filled(fill_value) return out - return m.filled(np.nan) + return m.filled(fill_value) def _nanmedian_dispatcher( diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 9552579cf..c4d625bd3 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1,4 +1,3 @@ -import sys import os import re import functools @@ -586,6 +585,10 @@ def savez(file, *args, **kwds): inside the ZIP archive. Therefore, keys should be valid filenames. E.g., avoid keys that begin with ``/`` or contain ``.``. + When naming variables with keyword arguments, it is not possible to name a + variable ``file``, as this would cause the ``file`` argument to be defined + twice in the call to ``savez``. + Examples -------- >>> from tempfile import TemporaryFile diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index e9df783b4..56fcce621 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -494,11 +494,11 @@ def polyfit(x, y, deg, rcond=None, full=False, w=None, cov=False): cov : bool or str, optional If given and not `False`, return not just the estimate but also its covariance matrix. By default, the covariance are scaled by - chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed - to be unreliable except in a relative sense and everything is scaled - such that the reduced chi2 is unity. This scaling is omitted if - ``cov='unscaled'``, as is relevant for the case that the weights are - 1/sigma**2, with sigma known to be a reliable estimate of the + chi2/dof, where dof = M - (deg + 1), i.e., the weights are presumed + to be unreliable except in a relative sense and everything is scaled + such that the reduced chi2 is unity. This scaling is omitted if + ``cov='unscaled'``, as is relevant for the case that the weights are + 1/sigma**2, with sigma known to be a reliable estimate of the uncertainty. Returns @@ -1394,9 +1394,9 @@ class poly1d: def __getitem__(self, val): ind = self.order - val if val > self.order: - return 0 + return self.coeffs.dtype.type(0) if val < 0: - return 0 + return self.coeffs.dtype.type(0) return self.coeffs[ind] def __setitem__(self, key, val): diff --git a/numpy/lib/tests/test_nanfunctions.py b/numpy/lib/tests/test_nanfunctions.py index e0f723a3c..1f1f5601b 100644 --- a/numpy/lib/tests/test_nanfunctions.py +++ b/numpy/lib/tests/test_nanfunctions.py @@ -588,6 +588,15 @@ class TestNanFunctions_MeanVarStd(SharedNanFunctionsTestsMixin): assert_(len(w) == 0) +_TIME_UNITS = ( + "Y", "M", "W", "D", "h", "m", "s", "ms", "us", "ns", "ps", "fs", "as" +) + +# All `inexact` + `timdelta64` type codes +_TYPE_CODES = list(np.typecodes["AllFloat"]) +_TYPE_CODES += [f"m8[{unit}]" for unit in _TIME_UNITS] + + class TestNanFunctions_Median: def test_mutation(self): @@ -662,23 +671,32 @@ class TestNanFunctions_Median: res = np.nanmedian(_ndat, axis=1) assert_almost_equal(res, tgt) - def test_allnans(self): - mat = np.array([np.nan]*9).reshape(3, 3) - for axis in [None, 0, 1]: - with suppress_warnings() as sup: - sup.record(RuntimeWarning) + @pytest.mark.parametrize("axis", [None, 0, 1]) + @pytest.mark.parametrize("dtype", _TYPE_CODES) + def test_allnans(self, dtype, axis): + mat = np.full((3, 3), np.nan).astype(dtype) + with suppress_warnings() as sup: + sup.record(RuntimeWarning) - assert_(np.isnan(np.nanmedian(mat, axis=axis)).all()) - if axis is None: - assert_(len(sup.log) == 1) - else: - assert_(len(sup.log) == 3) - # Check scalar - assert_(np.isnan(np.nanmedian(np.nan))) - if axis is None: - assert_(len(sup.log) == 2) - else: - assert_(len(sup.log) == 4) + output = np.nanmedian(mat, axis=axis) + assert output.dtype == mat.dtype + assert np.isnan(output).all() + + if axis is None: + assert_(len(sup.log) == 1) + else: + assert_(len(sup.log) == 3) + + # Check scalar + scalar = np.array(np.nan).astype(dtype)[()] + output_scalar = np.nanmedian(scalar) + assert output_scalar.dtype == scalar.dtype + assert np.isnan(output_scalar) + + if axis is None: + assert_(len(sup.log) == 2) + else: + assert_(len(sup.log) == 4) def test_empty(self): mat = np.zeros((0, 3)) diff --git a/numpy/lib/tests/test_polynomial.py b/numpy/lib/tests/test_polynomial.py index 6c3e4fa02..3734344d2 100644 --- a/numpy/lib/tests/test_polynomial.py +++ b/numpy/lib/tests/test_polynomial.py @@ -4,6 +4,12 @@ from numpy.testing import ( assert_array_almost_equal, assert_raises, assert_allclose ) +import pytest + +# `poly1d` has some support for `bool_` and `timedelta64`, +# but it is limited and they are therefore excluded here +TYPE_CODES = np.typecodes["AllInteger"] + np.typecodes["AllFloat"] + "O" + class TestPolynomial: def test_poly1d_str_and_repr(self): @@ -57,11 +63,26 @@ class TestPolynomial: assert_equal(np.polydiv(np.poly1d([1, 0, -1]), np.poly1d([1, 1])), (np.poly1d([1., -1.]), np.poly1d([0.]))) - def test_poly1d_misc(self): - p = np.poly1d([1., 2, 3]) - assert_equal(np.asarray(p), np.array([1., 2., 3.])) + @pytest.mark.parametrize("type_code", TYPE_CODES) + def test_poly1d_misc(self, type_code: str) -> None: + dtype = np.dtype(type_code) + ar = np.array([1, 2, 3], dtype=dtype) + p = np.poly1d(ar) + + # `__eq__` + assert_equal(np.asarray(p), ar) + assert_equal(np.asarray(p).dtype, dtype) assert_equal(len(p), 2) - assert_equal((p[0], p[1], p[2], p[3]), (3.0, 2.0, 1.0, 0)) + + # `__getitem__` + comparison_dct = {-1: 0, 0: 3, 1: 2, 2: 1, 3: 0} + for index, ref in comparison_dct.items(): + scalar = p[index] + assert_equal(scalar, ref) + if dtype == np.object_: + assert isinstance(scalar, int) + else: + assert_equal(scalar.dtype, dtype) def test_poly1d_variable_arg(self): q = np.poly1d([1., 2, 3], variable='y') @@ -257,7 +278,7 @@ class TestPolynomial: assert_equal(q.coeffs.dtype, np.complex128) assert_equal(r.coeffs.dtype, np.complex128) assert_equal(q*a + r, b) - + c = [1, 2, 3] d = np.poly1d([1, 2, 3]) s, t = np.polydiv(c, d) diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py index fd8c73573..ac5fe1c6b 100644 --- a/numpy/lib/twodim_base.py +++ b/numpy/lib/twodim_base.py @@ -737,6 +737,40 @@ def histogram2d(x, y, bins=10, range=None, normed=None, weights=None, >>> ax.images.append(im) >>> plt.show() + It is also possible to construct a 2-D histogram without specifying bin + edges: + + >>> # Generate non-symmetric test data + >>> n = 10000 + >>> x = np.linspace(1, 100, n) + >>> y = 2*np.log(x) + np.random.rand(n) - 0.5 + >>> # Compute 2d histogram. Note the order of x/y and xedges/yedges + >>> H, yedges, xedges = np.histogram2d(y, x, bins=20) + + Now we can plot the histogram using + :func:`pcolormesh <matplotlib.pyplot.pcolormesh>`, and a + :func:`hexbin <matplotlib.pyplot.hexbin>` for comparison. + + >>> # Plot histogram using pcolormesh + >>> fig, (ax1, ax2) = plt.subplots(ncols=2, sharey=True) + >>> ax1.pcolormesh(xedges, yedges, H, cmap='rainbow') + >>> ax1.plot(x, 2*np.log(x), 'k-') + >>> ax1.set_xlim(x.min(), x.max()) + >>> ax1.set_ylim(y.min(), y.max()) + >>> ax1.set_xlabel('x') + >>> ax1.set_ylabel('y') + >>> ax1.set_title('histogram2d') + >>> ax1.grid() + + >>> # Create hexbin plot for comparison + >>> ax2.hexbin(x, y, gridsize=20, cmap='rainbow') + >>> ax2.plot(x, 2*np.log(x), 'k-') + >>> ax2.set_title('hexbin') + >>> ax2.set_xlim(x.min(), x.max()) + >>> ax2.set_xlabel('x') + >>> ax2.grid() + + >>> plt.show() """ from numpy import histogramdd diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 63d42ecca..4c204cac2 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -40,7 +40,6 @@ from numpy.compat import ( from numpy import expand_dims from numpy.core.numeric import normalize_axis_tuple from numpy.core._internal import recursive -from numpy.compat import pickle __all__ = [ diff --git a/numpy/ma/extras.py b/numpy/ma/extras.py index bd5fc2ca3..c139f4640 100644 --- a/numpy/ma/extras.py +++ b/numpy/ma/extras.py @@ -33,7 +33,6 @@ from .core import ( import numpy as np from numpy import ndarray, array as nxarray -import numpy.core.umath as umath from numpy.core.multiarray import normalize_axis_index from numpy.core.numeric import normalize_axis_tuple from numpy.lib.function_base import _ureduce diff --git a/numpy/tests/test_numpy_version.py b/numpy/tests/test_numpy_version.py index 7fd566815..28595026e 100644 --- a/numpy/tests/test_numpy_version.py +++ b/numpy/tests/test_numpy_version.py @@ -1,3 +1,20 @@ +""" +Check the numpy version is valid. + +Note that a development version is marked by the presence of 'dev0' or '+' +in the version string, all else is treated as a release. The version string +itself is set from the output of ``git describe`` which relies on tags. + +Examples +-------- + +Valid Development: 1.22.0.dev0 1.22.0.dev0+5-g7999db4df2 1.22.0+5-g7999db4df2 +Valid Release: 1.21.0.rc1, 1.21.0.b1, 1.21.0 +Invalid: 1.22.0.dev, 1.22.0.dev0-5-g7999db4dfB, 1.21.0.d1, 1.21.a + +Note that a release is determined by the version string, which in turn +is controlled by the result of the ``git describe`` command. +""" import re import numpy as np @@ -7,11 +24,11 @@ from numpy.testing import assert_ def test_valid_numpy_version(): # Verify that the numpy version is a valid one (no .post suffix or other # nonsense). See gh-6431 for an issue caused by an invalid version. - version_pattern = r"^[0-9]+\.[0-9]+\.[0-9]+(|a[0-9]|b[0-9]|rc[0-9])" - dev_suffix = r"\.dev0\+[0-9]*\.g[0-9a-f]+" + version_pattern = r"^[0-9]+\.[0-9]+\.[0-9]+(a[0-9]|b[0-9]|rc[0-9]|)" + dev_suffix = r"(\.dev0|)(\+[0-9]*\.g[0-9a-f]+|)" if np.version.release: - res = re.match(version_pattern, np.__version__) + res = re.match(version_pattern + '$', np.__version__) else: - res = re.match(version_pattern + dev_suffix, np.__version__) + res = re.match(version_pattern + dev_suffix + '$', np.__version__) assert_(res is not None, np.__version__) diff --git a/numpy/typing/__init__.py b/numpy/typing/__init__.py index 424bd110a..252123a19 100644 --- a/numpy/typing/__init__.py +++ b/numpy/typing/__init__.py @@ -167,11 +167,19 @@ API from typing import TYPE_CHECKING, List if TYPE_CHECKING: - import sys - if sys.version_info >= (3, 8): - from typing import final + # typing_extensions is always available when type-checking + from typing_extensions import Literal as L + _HAS_TYPING_EXTENSIONS: L[True] +else: + try: + import typing_extensions + except ImportError: + _HAS_TYPING_EXTENSIONS = False else: - from typing_extensions import final + _HAS_TYPING_EXTENSIONS = True + +if TYPE_CHECKING: + from typing_extensions import final else: def final(f): return f @@ -207,14 +215,14 @@ class NBitBase: .. code-block:: python >>> from __future__ import annotations - >>> from typing import TypeVar, Union, TYPE_CHECKING + >>> from typing import TypeVar, TYPE_CHECKING >>> import numpy as np >>> import numpy.typing as npt >>> T1 = TypeVar("T1", bound=npt.NBitBase) >>> T2 = TypeVar("T2", bound=npt.NBitBase) - >>> def add(a: np.floating[T1], b: np.integer[T2]) -> np.floating[Union[T1, T2]]: + >>> def add(a: np.floating[T1], b: np.integer[T2]) -> np.floating[T1 | T2]: ... return a + b >>> a = np.float16() @@ -355,6 +363,7 @@ from ._array_like import ( ) from ._generic_alias import ( NDArray as NDArray, + _DType, _GenericAlias, ) diff --git a/numpy/typing/_add_docstring.py b/numpy/typing/_add_docstring.py index 34dbdb0c6..56ef41cfd 100644 --- a/numpy/typing/_add_docstring.py +++ b/numpy/typing/_add_docstring.py @@ -114,7 +114,7 @@ add_newdoc('DTypeLike', 'typing.Union[...]', add_newdoc('NDArray', repr(NDArray), """ A :term:`generic <generic type>` version of - `np.ndarray[Any, np.dtype[~ScalarType]] <numpy.ndarray>`. + `np.ndarray[Any, np.dtype[+ScalarType]] <numpy.ndarray>`. Can be used during runtime for typing arrays with a given dtype and unspecified shape. @@ -127,7 +127,7 @@ add_newdoc('NDArray', repr(NDArray), >>> import numpy.typing as npt >>> print(npt.NDArray) - numpy.ndarray[typing.Any, numpy.dtype[~ScalarType]] + numpy.ndarray[typing.Any, numpy.dtype[+ScalarType]] >>> print(npt.NDArray[np.float64]) numpy.ndarray[typing.Any, numpy.dtype[numpy.float64]] diff --git a/numpy/typing/_array_like.py b/numpy/typing/_array_like.py index 9f57b2295..2b823ecc0 100644 --- a/numpy/typing/_array_like.py +++ b/numpy/typing/_array_like.py @@ -1,7 +1,7 @@ from __future__ import annotations import sys -from typing import Any, overload, Sequence, TYPE_CHECKING, Union, TypeVar +from typing import Any, Sequence, TYPE_CHECKING, Union, TypeVar from numpy import ( ndarray, @@ -20,25 +20,21 @@ from numpy import ( str_, bytes_, ) + +from . import _HAS_TYPING_EXTENSIONS from ._dtype_like import DTypeLike if sys.version_info >= (3, 8): from typing import Protocol - HAVE_PROTOCOL = True -else: - try: - from typing_extensions import Protocol - except ImportError: - HAVE_PROTOCOL = False - else: - HAVE_PROTOCOL = True +elif _HAS_TYPING_EXTENSIONS: + from typing_extensions import Protocol _T = TypeVar("_T") _ScalarType = TypeVar("_ScalarType", bound=generic) _DType = TypeVar("_DType", bound="dtype[Any]") _DType_co = TypeVar("_DType_co", covariant=True, bound="dtype[Any]") -if TYPE_CHECKING or HAVE_PROTOCOL: +if TYPE_CHECKING or _HAS_TYPING_EXTENSIONS: # The `_SupportsArray` protocol only cares about the default dtype # (i.e. `dtype=None` or no `dtype` parameter at all) of the to-be returned # array. diff --git a/numpy/typing/_callable.py b/numpy/typing/_callable.py index d9cb0f157..54f9b1425 100644 --- a/numpy/typing/_callable.py +++ b/numpy/typing/_callable.py @@ -43,25 +43,17 @@ from ._scalars import ( _BoolLike_co, _IntLike_co, _FloatLike_co, - _ComplexLike_co, _NumberLike_co, ) -from . import NBitBase -from ._array_like import ArrayLike +from . import NBitBase, _HAS_TYPING_EXTENSIONS from ._generic_alias import NDArray if sys.version_info >= (3, 8): from typing import Protocol - HAVE_PROTOCOL = True -else: - try: - from typing_extensions import Protocol - except ImportError: - HAVE_PROTOCOL = False - else: - HAVE_PROTOCOL = True - -if TYPE_CHECKING or HAVE_PROTOCOL: +elif _HAS_TYPING_EXTENSIONS: + from typing_extensions import Protocol + +if TYPE_CHECKING or _HAS_TYPING_EXTENSIONS: _T1 = TypeVar("_T1") _T2 = TypeVar("_T2") _2Tuple = Tuple[_T1, _T1] @@ -110,7 +102,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: class _BoolTrueDiv(Protocol): @overload - def __call__(self, __other: Union[float, _IntLike_co]) -> float64: ... + def __call__(self, __other: float | _IntLike_co) -> float64: ... @overload def __call__(self, __other: complex) -> complex128: ... @overload @@ -134,7 +126,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload # platform dependent def __call__(self, __other: int) -> _2Tuple[int_]: ... @overload - def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... + def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ... @overload def __call__(self, __other: _IntType) -> _2Tuple[_IntType]: ... @overload @@ -152,15 +144,15 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__(self, __other: bool) -> floating[_NBit1]: ... @overload - def __call__(self, __other: int) -> floating[Union[_NBit1, _NBitInt]]: ... + def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ... @overload - def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... + def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ... @overload def __call__( self, __other: complex - ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... @overload - def __call__(self, __other: integer[_NBit2]) -> floating[Union[_NBit1, _NBit2]]: ... + def __call__(self, __other: integer[_NBit2]) -> floating[_NBit1 | _NBit2]: ... class _UnsignedIntOp(Protocol[_NBit1]): # NOTE: `uint64 + signedinteger -> float64` @@ -168,18 +160,18 @@ if TYPE_CHECKING or HAVE_PROTOCOL: def __call__(self, __other: bool) -> unsignedinteger[_NBit1]: ... @overload def __call__( - self, __other: Union[int, signedinteger[Any]] + self, __other: int | signedinteger[Any] ) -> Any: ... @overload - def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... + def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ... @overload def __call__( self, __other: complex - ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... @overload def __call__( self, __other: unsignedinteger[_NBit2] - ) -> unsignedinteger[Union[_NBit1, _NBit2]]: ... + ) -> unsignedinteger[_NBit1 | _NBit2]: ... class _UnsignedIntBitOp(Protocol[_NBit1]): @overload @@ -191,135 +183,135 @@ if TYPE_CHECKING or HAVE_PROTOCOL: @overload def __call__( self, __other: unsignedinteger[_NBit2] - ) -> unsignedinteger[Union[_NBit1, _NBit2]]: ... + ) -> unsignedinteger[_NBit1 | _NBit2]: ... class _UnsignedIntMod(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> unsignedinteger[_NBit1]: ... @overload def __call__( - self, __other: Union[int, signedinteger[Any]] + self, __other: int | signedinteger[Any] ) -> Any: ... @overload - def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... + def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ... @overload def __call__( self, __other: unsignedinteger[_NBit2] - ) -> unsignedinteger[Union[_NBit1, _NBit2]]: ... + ) -> unsignedinteger[_NBit1 | _NBit2]: ... class _UnsignedIntDivMod(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> _2Tuple[signedinteger[_NBit1]]: ... @overload def __call__( - self, __other: Union[int, signedinteger[Any]] + self, __other: int | signedinteger[Any] ) -> _2Tuple[Any]: ... @overload - def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... + def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ... @overload def __call__( self, __other: unsignedinteger[_NBit2] - ) -> _2Tuple[unsignedinteger[Union[_NBit1, _NBit2]]]: ... + ) -> _2Tuple[unsignedinteger[_NBit1 | _NBit2]]: ... class _SignedIntOp(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> signedinteger[_NBit1]: ... @overload - def __call__(self, __other: int) -> signedinteger[Union[_NBit1, _NBitInt]]: ... + def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ... @overload - def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... + def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ... @overload def __call__( self, __other: complex - ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... @overload def __call__( self, __other: signedinteger[_NBit2] - ) -> signedinteger[Union[_NBit1, _NBit2]]: ... + ) -> signedinteger[_NBit1 | _NBit2]: ... class _SignedIntBitOp(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> signedinteger[_NBit1]: ... @overload - def __call__(self, __other: int) -> signedinteger[Union[_NBit1, _NBitInt]]: ... + def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ... @overload def __call__( self, __other: signedinteger[_NBit2] - ) -> signedinteger[Union[_NBit1, _NBit2]]: ... + ) -> signedinteger[_NBit1 | _NBit2]: ... class _SignedIntMod(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> signedinteger[_NBit1]: ... @overload - def __call__(self, __other: int) -> signedinteger[Union[_NBit1, _NBitInt]]: ... + def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ... @overload - def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... + def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ... @overload def __call__( self, __other: signedinteger[_NBit2] - ) -> signedinteger[Union[_NBit1, _NBit2]]: ... + ) -> signedinteger[_NBit1 | _NBit2]: ... class _SignedIntDivMod(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> _2Tuple[signedinteger[_NBit1]]: ... @overload - def __call__(self, __other: int) -> _2Tuple[signedinteger[Union[_NBit1, _NBitInt]]]: ... + def __call__(self, __other: int) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ... @overload - def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... + def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ... @overload def __call__( self, __other: signedinteger[_NBit2] - ) -> _2Tuple[signedinteger[Union[_NBit1, _NBit2]]]: ... + ) -> _2Tuple[signedinteger[_NBit1 | _NBit2]]: ... class _FloatOp(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> floating[_NBit1]: ... @overload - def __call__(self, __other: int) -> floating[Union[_NBit1, _NBitInt]]: ... + def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ... @overload - def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... + def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ... @overload def __call__( self, __other: complex - ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... @overload def __call__( - self, __other: Union[integer[_NBit2], floating[_NBit2]] - ) -> floating[Union[_NBit1, _NBit2]]: ... + self, __other: integer[_NBit2] | floating[_NBit2] + ) -> floating[_NBit1 | _NBit2]: ... class _FloatMod(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> floating[_NBit1]: ... @overload - def __call__(self, __other: int) -> floating[Union[_NBit1, _NBitInt]]: ... + def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ... @overload - def __call__(self, __other: float) -> floating[Union[_NBit1, _NBitDouble]]: ... + def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ... @overload def __call__( - self, __other: Union[integer[_NBit2], floating[_NBit2]] - ) -> floating[Union[_NBit1, _NBit2]]: ... + self, __other: integer[_NBit2] | floating[_NBit2] + ) -> floating[_NBit1 | _NBit2]: ... class _FloatDivMod(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> _2Tuple[floating[_NBit1]]: ... @overload - def __call__(self, __other: int) -> _2Tuple[floating[Union[_NBit1, _NBitInt]]]: ... + def __call__(self, __other: int) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ... @overload - def __call__(self, __other: float) -> _2Tuple[floating[Union[_NBit1, _NBitDouble]]]: ... + def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ... @overload def __call__( - self, __other: Union[integer[_NBit2], floating[_NBit2]] - ) -> _2Tuple[floating[Union[_NBit1, _NBit2]]]: ... + self, __other: integer[_NBit2] | floating[_NBit2] + ) -> _2Tuple[floating[_NBit1 | _NBit2]]: ... class _ComplexOp(Protocol[_NBit1]): @overload def __call__(self, __other: bool) -> complexfloating[_NBit1, _NBit1]: ... @overload - def __call__(self, __other: int) -> complexfloating[Union[_NBit1, _NBitInt], Union[_NBit1, _NBitInt]]: ... + def __call__(self, __other: int) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ... @overload def __call__( - self, __other: Union[float, complex] - ) -> complexfloating[Union[_NBit1, _NBitDouble], Union[_NBit1, _NBitDouble]]: ... + self, __other: complex + ) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ... @overload def __call__( self, @@ -328,7 +320,7 @@ if TYPE_CHECKING or HAVE_PROTOCOL: floating[_NBit2], complexfloating[_NBit2, _NBit2], ] - ) -> complexfloating[Union[_NBit1, _NBit2], Union[_NBit1, _NBit2]]: ... + ) -> complexfloating[_NBit1 | _NBit2, _NBit1 | _NBit2]: ... class _NumberOp(Protocol): def __call__(self, __other: _NumberLike_co) -> Any: ... @@ -340,25 +332,25 @@ if TYPE_CHECKING or HAVE_PROTOCOL: def __call__(self, __other: _T2) -> NDArray[bool_]: ... else: - _BoolOp = Any - _BoolBitOp = Any - _BoolSub = Any - _BoolTrueDiv = Any - _BoolMod = Any - _BoolDivMod = Any - _TD64Div = Any - _IntTrueDiv = Any - _UnsignedIntOp = Any - _UnsignedIntBitOp = Any - _UnsignedIntMod = Any - _UnsignedIntDivMod = Any - _SignedIntOp = Any - _SignedIntBitOp = Any - _SignedIntMod = Any - _SignedIntDivMod = Any - _FloatOp = Any - _FloatMod = Any - _FloatDivMod = Any - _ComplexOp = Any - _NumberOp = Any - _ComparisonOp = Any + _BoolOp = NotImplemented + _BoolBitOp = NotImplemented + _BoolSub = NotImplemented + _BoolTrueDiv = NotImplemented + _BoolMod = NotImplemented + _BoolDivMod = NotImplemented + _TD64Div = NotImplemented + _IntTrueDiv = NotImplemented + _UnsignedIntOp = NotImplemented + _UnsignedIntBitOp = NotImplemented + _UnsignedIntMod = NotImplemented + _UnsignedIntDivMod = NotImplemented + _SignedIntOp = NotImplemented + _SignedIntBitOp = NotImplemented + _SignedIntMod = NotImplemented + _SignedIntDivMod = NotImplemented + _FloatOp = NotImplemented + _FloatMod = NotImplemented + _FloatDivMod = NotImplemented + _ComplexOp = NotImplemented + _NumberOp = NotImplemented + _ComparisonOp = NotImplemented diff --git a/numpy/typing/_char_codes.py b/numpy/typing/_char_codes.py index 6b6f7ae88..6b33f995d 100644 --- a/numpy/typing/_char_codes.py +++ b/numpy/typing/_char_codes.py @@ -1,18 +1,14 @@ import sys from typing import Any, TYPE_CHECKING +from . import _HAS_TYPING_EXTENSIONS + if sys.version_info >= (3, 8): from typing import Literal - HAVE_LITERAL = True -else: - try: - from typing_extensions import Literal - except ImportError: - HAVE_LITERAL = False - else: - HAVE_LITERAL = True - -if TYPE_CHECKING or HAVE_LITERAL: +elif _HAS_TYPING_EXTENSIONS: + from typing_extensions import Literal + +if TYPE_CHECKING or _HAS_TYPING_EXTENSIONS: _BoolCodes = Literal["?", "=?", "<?", ">?", "bool", "bool_", "bool8"] _UInt8Codes = Literal["uint8", "u1", "=u1", "<u1", ">u1"] @@ -124,52 +120,52 @@ if TYPE_CHECKING or HAVE_LITERAL: ] else: - _BoolCodes = Any - - _UInt8Codes = Any - _UInt16Codes = Any - _UInt32Codes = Any - _UInt64Codes = Any - - _Int8Codes = Any - _Int16Codes = Any - _Int32Codes = Any - _Int64Codes = Any - - _Float16Codes = Any - _Float32Codes = Any - _Float64Codes = Any - - _Complex64Codes = Any - _Complex128Codes = Any - - _ByteCodes = Any - _ShortCodes = Any - _IntCCodes = Any - _IntPCodes = Any - _IntCodes = Any - _LongLongCodes = Any - - _UByteCodes = Any - _UShortCodes = Any - _UIntCCodes = Any - _UIntPCodes = Any - _UIntCodes = Any - _ULongLongCodes = Any - - _HalfCodes = Any - _SingleCodes = Any - _DoubleCodes = Any - _LongDoubleCodes = Any - - _CSingleCodes = Any - _CDoubleCodes = Any - _CLongDoubleCodes = Any - - _StrCodes = Any - _BytesCodes = Any - _VoidCodes = Any - _ObjectCodes = Any - - _DT64Codes = Any - _TD64Codes = Any + _BoolCodes = NotImplemented + + _UInt8Codes = NotImplemented + _UInt16Codes = NotImplemented + _UInt32Codes = NotImplemented + _UInt64Codes = NotImplemented + + _Int8Codes = NotImplemented + _Int16Codes = NotImplemented + _Int32Codes = NotImplemented + _Int64Codes = NotImplemented + + _Float16Codes = NotImplemented + _Float32Codes = NotImplemented + _Float64Codes = NotImplemented + + _Complex64Codes = NotImplemented + _Complex128Codes = NotImplemented + + _ByteCodes = NotImplemented + _ShortCodes = NotImplemented + _IntCCodes = NotImplemented + _IntPCodes = NotImplemented + _IntCodes = NotImplemented + _LongLongCodes = NotImplemented + + _UByteCodes = NotImplemented + _UShortCodes = NotImplemented + _UIntCCodes = NotImplemented + _UIntPCodes = NotImplemented + _UIntCodes = NotImplemented + _ULongLongCodes = NotImplemented + + _HalfCodes = NotImplemented + _SingleCodes = NotImplemented + _DoubleCodes = NotImplemented + _LongDoubleCodes = NotImplemented + + _CSingleCodes = NotImplemented + _CDoubleCodes = NotImplemented + _CLongDoubleCodes = NotImplemented + + _StrCodes = NotImplemented + _BytesCodes = NotImplemented + _VoidCodes = NotImplemented + _ObjectCodes = NotImplemented + + _DT64Codes = NotImplemented + _TD64Codes = NotImplemented diff --git a/numpy/typing/_dtype_like.py b/numpy/typing/_dtype_like.py index a41e2f358..405cc4a3c 100644 --- a/numpy/typing/_dtype_like.py +++ b/numpy/typing/_dtype_like.py @@ -2,18 +2,20 @@ import sys from typing import Any, List, Sequence, Tuple, Union, Type, TypeVar, TYPE_CHECKING import numpy as np + +from . import _HAS_TYPING_EXTENSIONS from ._shape import _ShapeLike +from ._generic_alias import _DType as DType if sys.version_info >= (3, 8): from typing import Protocol, TypedDict - HAVE_PROTOCOL = True +elif _HAS_TYPING_EXTENSIONS: + from typing_extensions import Protocol, TypedDict + +if sys.version_info >= (3, 9): + from types import GenericAlias else: - try: - from typing_extensions import Protocol, TypedDict - except ImportError: - HAVE_PROTOCOL = False - else: - HAVE_PROTOCOL = True + from ._generic_alias import _GenericAlias as GenericAlias from ._char_codes import ( _BoolCodes, @@ -58,8 +60,9 @@ from ._char_codes import ( ) _DTypeLikeNested = Any # TODO: wait for support for recursive types +_DType_co = TypeVar("_DType_co", covariant=True, bound=DType[Any]) -if TYPE_CHECKING or HAVE_PROTOCOL: +if TYPE_CHECKING or _HAS_TYPING_EXTENSIONS: # Mandatory keys class _DTypeDictBase(TypedDict): names: Sequence[str] @@ -72,16 +75,16 @@ if TYPE_CHECKING or HAVE_PROTOCOL: itemsize: int aligned: bool - _DType_co = TypeVar("_DType_co", covariant=True, bound=np.dtype) - # A protocol for anything with the dtype attribute class _SupportsDType(Protocol[_DType_co]): @property def dtype(self) -> _DType_co: ... else: - _DTypeDict = Any - _SupportsDType = Any + _DTypeDict = NotImplemented + + class _SupportsDType: ... + _SupportsDType = GenericAlias(_SupportsDType, _DType_co) # Would create a dtype[np.void] @@ -106,13 +109,13 @@ _VoidDTypeLike = Union[ # Anything that can be coerced into numpy.dtype. # Reference: https://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html DTypeLike = Union[ - np.dtype, + DType[Any], # default data type (float64) None, # array-scalar types and generic types - type, # TODO: enumerate these when we add type hints for numpy scalars + Type[Any], # TODO: enumerate these when we add type hints for numpy scalars # anything with a dtype attribute - "_SupportsDType[np.dtype[Any]]", + _SupportsDType[DType[Any]], # character codes, type strings or comma-separated fields, e.g., 'float64' str, _VoidDTypeLike, @@ -130,14 +133,14 @@ DTypeLike = Union[ _DTypeLikeBool = Union[ Type[bool], Type[np.bool_], - "np.dtype[np.bool_]", - "_SupportsDType[np.dtype[np.bool_]]", + DType[np.bool_], + _SupportsDType[DType[np.bool_]], _BoolCodes, ] _DTypeLikeUInt = Union[ Type[np.unsignedinteger], - "np.dtype[np.unsignedinteger]", - "_SupportsDType[np.dtype[np.unsignedinteger]]", + DType[np.unsignedinteger], + _SupportsDType[DType[np.unsignedinteger]], _UInt8Codes, _UInt16Codes, _UInt32Codes, @@ -152,8 +155,8 @@ _DTypeLikeUInt = Union[ _DTypeLikeInt = Union[ Type[int], Type[np.signedinteger], - "np.dtype[np.signedinteger]", - "_SupportsDType[np.dtype[np.signedinteger]]", + DType[np.signedinteger], + _SupportsDType[DType[np.signedinteger]], _Int8Codes, _Int16Codes, _Int32Codes, @@ -168,8 +171,8 @@ _DTypeLikeInt = Union[ _DTypeLikeFloat = Union[ Type[float], Type[np.floating], - "np.dtype[np.floating]", - "_SupportsDType[np.dtype[np.floating]]", + DType[np.floating], + _SupportsDType[DType[np.floating]], _Float16Codes, _Float32Codes, _Float64Codes, @@ -181,8 +184,8 @@ _DTypeLikeFloat = Union[ _DTypeLikeComplex = Union[ Type[complex], Type[np.complexfloating], - "np.dtype[np.complexfloating]", - "_SupportsDType[np.dtype[np.complexfloating]]", + DType[np.complexfloating], + _SupportsDType[DType[np.complexfloating]], _Complex64Codes, _Complex128Codes, _CSingleCodes, @@ -191,41 +194,41 @@ _DTypeLikeComplex = Union[ ] _DTypeLikeDT64 = Union[ Type[np.timedelta64], - "np.dtype[np.timedelta64]", - "_SupportsDType[np.dtype[np.timedelta64]]", + DType[np.timedelta64], + _SupportsDType[DType[np.timedelta64]], _TD64Codes, ] _DTypeLikeTD64 = Union[ Type[np.datetime64], - "np.dtype[np.datetime64]", - "_SupportsDType[np.dtype[np.datetime64]]", + DType[np.datetime64], + _SupportsDType[DType[np.datetime64]], _DT64Codes, ] _DTypeLikeStr = Union[ Type[str], Type[np.str_], - "np.dtype[np.str_]", - "_SupportsDType[np.dtype[np.str_]]", + DType[np.str_], + _SupportsDType[DType[np.str_]], _StrCodes, ] _DTypeLikeBytes = Union[ Type[bytes], Type[np.bytes_], - "np.dtype[np.bytes_]", - "_SupportsDType[np.dtype[np.bytes_]]", + DType[np.bytes_], + _SupportsDType[DType[np.bytes_]], _BytesCodes, ] _DTypeLikeVoid = Union[ Type[np.void], - "np.dtype[np.void]", - "_SupportsDType[np.dtype[np.void]]", + DType[np.void], + _SupportsDType[DType[np.void]], _VoidCodes, _VoidDTypeLike, ] _DTypeLikeObject = Union[ type, - "np.dtype[np.object_]", - "_SupportsDType[np.dtype[np.object_]]", + DType[np.object_], + _SupportsDType[DType[np.object_]], _ObjectCodes, ] diff --git a/numpy/typing/_generic_alias.py b/numpy/typing/_generic_alias.py index f98fca62e..0d30f54ca 100644 --- a/numpy/typing/_generic_alias.py +++ b/numpy/typing/_generic_alias.py @@ -63,7 +63,8 @@ def _reconstruct_alias(alias: _T, parameters: Iterator[TypeVar]) -> _T: elif isinstance(i, _GenericAlias): value = _reconstruct_alias(i, parameters) elif hasattr(i, "__parameters__"): - value = i[next(parameters)] + prm_tup = tuple(next(parameters) for _ in i.__parameters__) + value = i[prm_tup] else: value = i args.append(value) @@ -195,9 +196,10 @@ if sys.version_info >= (3, 9): else: _GENERIC_ALIAS_TYPE = (_GenericAlias,) -ScalarType = TypeVar("ScalarType", bound=np.generic) +ScalarType = TypeVar("ScalarType", bound=np.generic, covariant=True) if TYPE_CHECKING: + _DType = np.dtype[ScalarType] NDArray = np.ndarray[Any, np.dtype[ScalarType]] elif sys.version_info >= (3, 9): _DType = types.GenericAlias(np.dtype, (ScalarType,)) diff --git a/numpy/typing/_shape.py b/numpy/typing/_shape.py index b720c3ffc..0742be8a9 100644 --- a/numpy/typing/_shape.py +++ b/numpy/typing/_shape.py @@ -1,13 +1,14 @@ import sys from typing import Sequence, Tuple, Union +from . import _HAS_TYPING_EXTENSIONS + if sys.version_info >= (3, 8): from typing import SupportsIndex +elif _HAS_TYPING_EXTENSIONS: + from typing_extensions import SupportsIndex else: - try: - from typing_extensions import SupportsIndex - except ImportError: - SupportsIndex = NotImplemented + SupportsIndex = NotImplemented _Shape = Tuple[int, ...] diff --git a/numpy/typing/_ufunc.pyi b/numpy/typing/_ufunc.pyi index b3b9fa95e..f4fead504 100644 --- a/numpy/typing/_ufunc.pyi +++ b/numpy/typing/_ufunc.pyi @@ -11,11 +11,9 @@ from typing import ( Any, Generic, List, - Optional, overload, Tuple, TypeVar, - Union, ) from numpy import ufunc, _Casting, _OrderKACF @@ -82,26 +80,26 @@ class _UFunc_Nin1_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): __x1: _ScalarLike_co, out: None = ..., *, - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _2Tuple[Optional[str]]] = ..., + signature: str | _2Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> Any: ... @overload def __call__( self, __x1: ArrayLike, - out: Union[None, NDArray[Any], Tuple[NDArray[Any]]] = ..., + out: None | NDArray[Any] | Tuple[NDArray[Any]] = ..., *, - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _2Tuple[Optional[str]]] = ..., + signature: str | _2Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> NDArray[Any]: ... @@ -134,12 +132,12 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): __x2: _ScalarLike_co, out: None = ..., *, - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _3Tuple[Optional[str]]] = ..., + signature: str | _3Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> Any: ... @overload @@ -147,14 +145,14 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): self, __x1: ArrayLike, __x2: ArrayLike, - out: Union[None, NDArray[Any], Tuple[NDArray[Any]]] = ..., + out: None | NDArray[Any] | Tuple[NDArray[Any]] = ..., *, - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _3Tuple[Optional[str]]] = ..., + signature: str | _3Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> NDArray[Any]: ... @@ -168,9 +166,9 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): def reduce( self, array: ArrayLike, - axis: Optional[_ShapeLike] = ..., + axis: None | _ShapeLike = ..., dtype: DTypeLike = ..., - out: Optional[NDArray[Any]] = ..., + out: None | NDArray[Any] = ..., keepdims: bool = ..., initial: Any = ..., where: _ArrayLikeBool_co = ..., @@ -181,7 +179,7 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): array: ArrayLike, axis: SupportsIndex = ..., dtype: DTypeLike = ..., - out: Optional[NDArray[Any]] = ..., + out: None | NDArray[Any] = ..., ) -> NDArray[Any]: ... def reduceat( @@ -190,7 +188,7 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): indices: _ArrayLikeInt_co, axis: SupportsIndex = ..., dtype: DTypeLike = ..., - out: Optional[NDArray[Any]] = ..., + out: None | NDArray[Any] = ..., ) -> NDArray[Any]: ... # Expand `**kwargs` into explicit keyword-only arguments @@ -201,12 +199,12 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): __B: _ScalarLike_co, *, out: None = ..., - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _3Tuple[Optional[str]]] = ..., + signature: str | _3Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> Any: ... @overload @@ -215,13 +213,13 @@ class _UFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): __A: ArrayLike, __B: ArrayLike, *, - out: Union[None, NDArray[Any], Tuple[NDArray[Any]]] = ..., - where: Optional[_ArrayLikeBool_co] = ..., + out: None | NDArray[Any] | Tuple[NDArray[Any]] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _3Tuple[Optional[str]]] = ..., + signature: str | _3Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> NDArray[Any]: ... @@ -258,28 +256,28 @@ class _UFunc_Nin1_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): __out1: None = ..., __out2: None = ..., *, - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _3Tuple[Optional[str]]] = ..., + signature: str | _3Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> _2Tuple[Any]: ... @overload def __call__( self, __x1: ArrayLike, - __out1: Optional[NDArray[Any]] = ..., - __out2: Optional[NDArray[Any]] = ..., + __out1: None | NDArray[Any] = ..., + __out2: None | NDArray[Any] = ..., *, out: _2Tuple[NDArray[Any]] = ..., - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _3Tuple[Optional[str]]] = ..., + signature: str | _3Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> _2Tuple[NDArray[Any]]: ... @@ -317,12 +315,12 @@ class _UFunc_Nin2_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): __out1: None = ..., __out2: None = ..., *, - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _4Tuple[Optional[str]]] = ..., + signature: str | _4Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> _2Tuple[Any]: ... @overload @@ -330,16 +328,16 @@ class _UFunc_Nin2_Nout2(ufunc, Generic[_NameType, _NTypes, _IDType]): self, __x1: ArrayLike, __x2: ArrayLike, - __out1: Optional[NDArray[Any]] = ..., - __out2: Optional[NDArray[Any]] = ..., + __out1: None | NDArray[Any] = ..., + __out2: None | NDArray[Any] = ..., *, out: _2Tuple[NDArray[Any]] = ..., - where: Optional[_ArrayLikeBool_co] = ..., + where: None | _ArrayLikeBool_co = ..., casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _4Tuple[Optional[str]]] = ..., + signature: str | _4Tuple[None | str] = ..., extobj: List[Any] = ..., ) -> _2Tuple[NDArray[Any]]: ... @@ -384,7 +382,7 @@ class _GUFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _3Tuple[Optional[str]]] = ..., + signature: str | _3Tuple[None | str] = ..., extobj: List[Any] = ..., axes: List[_2Tuple[SupportsIndex]] = ..., ) -> Any: ... @@ -393,13 +391,13 @@ class _GUFunc_Nin2_Nout1(ufunc, Generic[_NameType, _NTypes, _IDType]): self, __x1: ArrayLike, __x2: ArrayLike, - out: Union[NDArray[Any], Tuple[NDArray[Any]]], + out: NDArray[Any] | Tuple[NDArray[Any]], *, casting: _Casting = ..., order: _OrderKACF = ..., dtype: DTypeLike = ..., subok: bool = ..., - signature: Union[str, _3Tuple[Optional[str]]] = ..., + signature: str | _3Tuple[None | str] = ..., extobj: List[Any] = ..., axes: List[_2Tuple[SupportsIndex]] = ..., ) -> NDArray[Any]: ... diff --git a/numpy/typing/mypy_plugin.py b/numpy/typing/mypy_plugin.py index db2dc9b2d..74dcd7a85 100644 --- a/numpy/typing/mypy_plugin.py +++ b/numpy/typing/mypy_plugin.py @@ -14,7 +14,7 @@ try: from mypy.build import PRI_MED _HookFunc = t.Callable[[AnalyzeTypeContext], Type] - MYPY_EX: t.Optional[ModuleNotFoundError] = None + MYPY_EX: None | ModuleNotFoundError = None except ModuleNotFoundError as ex: MYPY_EX = ex @@ -121,7 +121,7 @@ if t.TYPE_CHECKING or MYPY_EX is None: class _NumpyPlugin(Plugin): """A mypy plugin for handling versus numpy-specific typing tasks.""" - def get_type_analyze_hook(self, fullname: str) -> t.Optional[_HookFunc]: + def get_type_analyze_hook(self, fullname: str) -> None | _HookFunc: """Set the precision of platform-specific `numpy.number` subclasses. For example: `numpy.int_`, `numpy.longlong` and `numpy.longdouble`. diff --git a/numpy/typing/tests/test_generic_alias.py b/numpy/typing/tests/test_generic_alias.py index 13072051a..0b9917439 100644 --- a/numpy/typing/tests/test_generic_alias.py +++ b/numpy/typing/tests/test_generic_alias.py @@ -10,7 +10,9 @@ import pytest import numpy as np from numpy.typing._generic_alias import _GenericAlias -ScalarType = TypeVar("ScalarType", bound=np.generic) +ScalarType = TypeVar("ScalarType", bound=np.generic, covariant=True) +T1 = TypeVar("T1") +T2 = TypeVar("T2") DType = _GenericAlias(np.dtype, (ScalarType,)) NDArray = _GenericAlias(np.ndarray, (Any, DType)) @@ -50,6 +52,7 @@ class TestGenericAlias: ("__getitem__", lambda n: n[np.float64]), ("__getitem__", lambda n: n[ScalarType][np.float64]), ("__getitem__", lambda n: n[Union[np.int64, ScalarType]][np.float64]), + ("__getitem__", lambda n: n[Union[T1, T2]][np.float32, np.float64]), ("__eq__", lambda n: n == n), ("__ne__", lambda n: n != np.ndarray), ("__dir__", lambda n: dir(n)), diff --git a/numpy/version.py b/numpy/version.py index 8a1d05aa4..48bdb32da 100644 --- a/numpy/version.py +++ b/numpy/version.py @@ -6,6 +6,6 @@ vinfo = get_versions() version: str = vinfo["version"] full_version: str = vinfo['version'] git_revision: str = vinfo['full-revisionid'] -release = 'dev0' not in version +release = 'dev0' not in version and '+' not in version del get_versions, vinfo diff --git a/pavement.py b/pavement.py index 66c2cf953..43ed14a51 100644 --- a/pavement.py +++ b/pavement.py @@ -38,7 +38,7 @@ from paver.easy import Bunch, options, task, sh #----------------------------------- # Path to the release notes -RELEASE_NOTES = 'doc/source/release/1.21.0-notes.rst' +RELEASE_NOTES = 'doc/source/release/1.22.0-notes.rst' #------------------------------------------------------- @@ -25,6 +25,7 @@ import subprocess import textwrap import warnings import builtins +import re # Python supported version checks. Keep right after stdlib imports to ensure we @@ -46,8 +47,14 @@ builtins.__NUMPY_SETUP__ = True # The version components are changed from ints to strings, but only VERSION # seems to matter outside of this module and it was already a str. FULLVERSION = versioneer.get_version() -ISRELEASED = 'dev' not in FULLVERSION -MAJOR, MINOR, MICRO = FULLVERSION.split('.')[:3] + +# Capture the version string: +# 1.22.0.dev0+ ... -> ISRELEASED == False, VERSION == 1.22.0 +# 1.22.0rc1+ ... -> ISRELEASED == False, VERSION == 1.22.0 +# 1.22.0 ... -> ISRELEASED == True, VERSION == 1.22.0 +# 1.22.0rc1 ... -> ISRELEASED == True, VERSION == 1.22.0 +ISRELEASED = re.search(r'(dev|\+)', FULLVERSION) is None +MAJOR, MINOR, MICRO = re.match(r'(\d+)\.(\d+)\.(\d+)', FULLVERSION).groups() VERSION = '{}.{}.{}'.format(MAJOR, MINOR, MICRO) # The first version not in the `Programming Language :: Python :: ...` classifiers above diff --git a/test_requirements.txt b/test_requirements.txt index e23ec0333..9c75cb58c 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,7 +1,7 @@ cython==0.29.23 wheel<0.36.3 setuptools<49.2.0 -hypothesis==6.12.0 +hypothesis==6.13.4 pytest==6.2.4 pytz==2021.1 pytest-cov==2.12.0 diff --git a/tools/gitpod/gitpod.Dockerfile b/tools/gitpod/gitpod.Dockerfile index ad731fd63..7791df191 100644 --- a/tools/gitpod/gitpod.Dockerfile +++ b/tools/gitpod/gitpod.Dockerfile @@ -5,7 +5,9 @@ ARG BASE_CONTAINER="numpy/numpy-dev:latest" FROM gitpod/workspace-base:latest as clone COPY --chown=gitpod . /tmp/numpy_repo -RUN git clone --depth 1 file:////tmp/numpy_repo /tmp/numpy + +# the clone should be deep enough for versioneer to work +RUN git clone --shallow-since=2021-05-22 file:////tmp/numpy_repo /tmp/numpy # ----------------------------------------------------------------------------- # Using the numpy-dev Docker image as a base |