-
Notifications
You must be signed in to change notification settings - Fork 0
Streamlining the imports #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit refactors backend_bases into two parts, the Gcf independent parts, which moved to backends/_backend_bases.py, and the Gcf dependent stuff which stayed in backend_bases.py. The contents of backends/_backend_bases.py are bulk imported into backend_bases so this change should be backwards compatible. Added an attribute to FigureManagerBase for the _key_press_handler function. This might be a stop-gap if the logic in `Gcf.destroy` should be moved into the FigureManager or canvas classes.
added a static method to FigureManagerQt to gracefully patch in the Gcf.destroy call back. As with the _key_press_handler call back this may be a stop-gap if that logic gets re-factored.
One part (_backend_qt4Agg.py) has no dependencies on Gcf or pyplot, which are all collected in backend_qt4agg.py. Should be fully back-wards compatible.
get pop-up graph windows as part of a larger gui application.
Two line-length violations on long urls in comments are left.
changed imports to _backend_bases to avoid implicit Gcf import
one which includes Gcf and one that does not.
_backend_gtkagg.py has no dependence on `Gcf`, backend_gtkagg.py depends on `Gcf` and maintains reverse compatibility.
Same long url as backend_gkt.py is the lone violation
_backend_gtk3.py does not depend on `Gcf`. backend_gkt3.py does depend on `Gcf` and maintains reverse compatibility
gcf independent parts. Same poor naming scheme as everything else in this branch.
and one not. Same naming scheme as rest.
updated example to reflect that the class the class `FigureManagerQTAgg` has been removed.
Added `FigureCanvas` and `FigureManager` aliases to `_backend_qt4agg.py` and `_backend_qt4.py`.
adjusting imports
The problem with this is that we need to maintain reverse compatibility. I am pretty sure that the existing top level modules export You have a fair point about the call backs design-wise, however one of the goals here is to break nothing. The callbacks used to be in the baseclases in I may be taking no reverse incompatible changes a little too seriously. I would like feed back from @mdboom and company on this. |
-1 on removing FigureManager from the namespaces +1 on not redefining the callbacks in *Agg and *Cairo, which should already be there from the base classes. |
Right, I didn't follow through the inheritance/had them siloed wrong in my head last night. The same thing should be done for @fariza Let me know if you want to make the changes. I want to get this merged before I do the rebase (which I am not looking forward to). |
The @mdboom Why do you want to expose these two "names" in classes that can not be used directly? @tacaswell I think the best would be just to keep modifing two backends qt4 and Gtk3 until we agree on the way to do it (on the fly assemby by pyplot, or two files per backend, or ....) then we can modify all the rest. |
@fariza Fair enough on just doing two at first. |
I am coming around to your suggestion of only exporting I had not realized how new that naming scheme was. @pwuertz Can you comment on this? |
@tacaswell When switching to a different backend for saving figures, After matplotlib/matplotlib@8159c81 there is just a mapping from file types to backend modules, which can be modified and extended at runtime. You still need to know the name of a module's At the moment it is safe to omit this alias if you are not planning to use that backend for file saving. |
This fixes some possible heap buffer overflows, such as the following triggered by our cmmi10.ttf: ``` ERROR: AddressSanitizer: heap-buffer-overflow on address 0x617000235709 at pc 0x7f95efd3c48a bp 0x7ffe41b6ecc0 sp 0x7ffe41b6ecb0 READ of size 1 at 0x617000235709 thread T0 #0 0x7f95efd3c489 in utf16be_to_ascii extern/ttconv/pprdrv_tt.cpp:178 #1 0x7f95efd3c489 in Read_name(TTFONT*) extern/ttconv/pprdrv_tt.cpp:339 #2 0x7f95efd499ef in read_font(...) extern/ttconv/pprdrv_tt.cpp:1325 #3 0x7f95efd4c602 in get_pdf_charprocs(...) extern/ttconv/pprdrv_tt.cpp:1420 #4 0x7f95efd35c22 in py_get_pdf_charprocs src/_ttconv.cpp:217 0x617000235709 is located 1 bytes to the right of 648-byte region [0x617000235480,0x617000235708) allocated by thread T0 here: #0 0x7f9612262a38 in __interceptor_calloc (/usr/lib64/libasan.so.4+0xdea38) #1 0x7f95efd3b261 in GetTable(TTFONT*, char const*) extern/ttconv/pprdrv_tt.cpp:140 ```
commit a05a486 Merge: 6ec4f8f e751286 Author: Ida Hjorth <idahjorth@gmail.com> Date: Sun Apr 29 19:07:32 2018 +0200 Merge pull request #3 from magnunor/idahj_anchored_directionarrows Idahj anchored directionarrows commit e751286 Merge: 3ba79fb 6ec4f8f Author: Magnus Nord <magnunor@gmail.com> Date: Sun Apr 29 09:00:34 2018 +0200 Merge branch 'NEW_AnchoredDirectionArrows' of github.com:idahj/matplotlib into idahj_anchored_directionarrows commit 6ec4f8f Author: Ida <idahjorth@gmail.com> Date: Fri Aug 25 13:14:26 2017 +0100 AnchoredDirectionArrows: Docstring, what's new commit 19f4a38 Author: Ida <idahjorth@gmail.com> Date: Thu Aug 24 14:27:23 2017 +0100 AnchoredDirectionArrows: Demo docstring commit d024684 Author: Ida <idahjorth@gmail.com> Date: Thu Aug 24 14:09:52 2017 +0100 AnchoredDirectionArrows: Fix error commit 27b6bc5 Author: Ida <idahjorth@gmail.com> Date: Thu Aug 24 13:58:58 2017 +0100 AnchoredDirectionArrows: make variable not private commit c0762d2 Author: Ida <idahjorth@gmail.com> Date: Thu Aug 24 13:02:38 2017 +0100 AnchoredDirectionArrows: Add docstring in demo commit 88d04d0 Author: Ida <idahjorth@gmail.com> Date: Wed Aug 23 14:19:06 2017 +0100 AnchoredDirectionArrows: docstring, what's new commit efcca59 Author: Magnus Nord <Magnus.Nord@glasgow.ac.uk> Date: Wed Aug 23 13:31:32 2017 +0100 AnchoredDirectionArrows: add test which uses many of the arguments commit e200c44 Author: Magnus Nord <Magnus.Nord@glasgow.ac.uk> Date: Wed Aug 23 12:06:05 2017 +0100 AnchoredDirectionArrows: minor docstring changes commit b6b0ea2 Author: Ida <idahjorth@gmail.com> Date: Tue Aug 22 13:28:56 2017 +0100 AnchoredDirectionArrows: PEP8 commit 5fde65a Author: Ida <idahjorth@gmail.com> Date: Tue Aug 22 13:23:25 2017 +0100 AnchoredDirectionArrows: Add demo commit 23f7d5b Author: Ida <idahjorth@gmail.com> Date: Tue Aug 22 11:16:41 2017 +0100 AnchoredDirectionArrows: Add working unit test commit 459ae07 Author: Ida <idahjorth@gmail.com> Date: Tue Aug 22 10:37:44 2017 +0100 AnchoredDirectionArrow: first attempt unit test Currently not working commit f4ec0e2 Author: Ida <idahjorth@gmail.com> Date: Wed Aug 16 19:31:05 2017 +0100 Cleanup, bug fix, begin merge overlapping arrows commit 75e52b0 Author: Magnus Nord <magnunor@gmail.com> Date: Mon Aug 14 23:05:30 2017 +0100 AnchoredDirectionArrows: PEP8 fixes, and improve docstring commit 4fff775 Author: Ida <idahjorth@gmail.com> Date: Mon Aug 14 22:04:22 2017 +0100 Add AnchoredDirectionArrows class in axes_grid1
The attempt to simplify the stride calculation in `a06f343dee3cebf035b74f65ea00b8842af448e9` seems to be the cause of the problem. Using an approach equivalent to what was there before hopefully resolves matplotlib#24092.
This came after reading trhought the code trying to understand the flow of things.
Please correct me if I'm wrong
Figuremanager and FigureCanvas
If I understood correctly
Figuremanager
andFigureCanvas
should be reserved for ready to use classesI removed
Figuremanager
andFigureCanvas
from_backend_gtk3.py
backend_gtk3.py
_backend_qt4.py
backend_qt4.py
Those classes are not usable by as they are they have to be used with
Agg
orCairo
,.Callbacks setting
There is no need to duplicate the setting of callbacks, it should remain in
backend_gtk3.py
andbackend_qt4.py
.The
Agg
orCairo
variants don't need to redefine this.