Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7b2d828

Browse files
authored
Merge pull request#22516 from oscargus/backenddeprecations
Expire deprecations in backends
2 parentsed5c0b3 +e1eca0a commit7b2d828

File tree

8 files changed

+27
-76
lines changed

8 files changed

+27
-76
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Removal of deprecations in ``backends``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
The parameter ``resize_callback`` is removed from the Tk backend. Instead,
5+
use ``get_tk_widget().bind('<Configure>', ..., True)``.
6+
7+
The ``get_content_extents()`` and ``tostring_rgba_minimized()`` methods are
8+
removed from the Agg backend with no replacements.
9+
10+
The parameter ``dpi`` is removed from ``print_ps()`` in the PS backend and
11+
``print_pdf()`` in the PDF backend. Instead, the methods obtain the DPI from
12+
the ``savefig`` machinery.
13+
14+
The classes ``TmpDirCleaner`` and ``GraphicsContextPS`` are removed from the
15+
PGF and PS backends, respectively. For the latter, ``GraphicsContextBase`` can
16+
be used as a replacement.
17+
18+
In the WX backend, the property ``IDLE_DELAY`` is removed. In addition, the
19+
parameter ``origin`` of ``gui_repaint()`` is removed, as well as the method
20+
``get_canvas()``. No replacements are provided.

‎lib/matplotlib/backends/_backend_tk.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ def _on_timer(self):
163163
classFigureCanvasTk(FigureCanvasBase):
164164
required_interactive_framework="tk"
165165

166-
@_api.delete_parameter(
167-
"3.4","resize_callback",
168-
alternative="get_tk_widget().bind('<Configure>', ..., True)")
169-
def__init__(self,figure=None,master=None,resize_callback=None):
166+
def__init__(self,figure=None,master=None):
170167
super().__init__(figure)
171168
self._idle_draw_id=None
172169
self._event_loop_id=None
@@ -177,7 +174,6 @@ def __init__(self, figure=None, master=None, resize_callback=None):
177174
self._tkphoto=tk.PhotoImage(
178175
master=self._tkcanvas,width=w,height=h)
179176
self._tkcanvas.create_image(w//2,h//2,image=self._tkphoto)
180-
self._resize_callback=resize_callback
181177
self._tkcanvas.bind("<Configure>",self.resize)
182178
self._tkcanvas.bind("<Map>",self._update_device_pixel_ratio)
183179
self._tkcanvas.bind("<Key>",self.key_press)
@@ -229,8 +225,6 @@ def _update_device_pixel_ratio(self, event=None):
229225

230226
defresize(self,event):
231227
width,height=event.width,event.height
232-
ifself._resize_callbackisnotNone:
233-
self._resize_callback(event)
234228

235229
# compute desired figure size in inches
236230
dpival=self.figure.dpi

‎lib/matplotlib/backends/backend_agg.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,21 +112,6 @@ def _update_methods(self):
112112
self.draw_quad_mesh=self._renderer.draw_quad_mesh
113113
self.copy_from_bbox=self._renderer.copy_from_bbox
114114

115-
@_api.deprecated("3.4")
116-
defget_content_extents(self):
117-
orig_img=np.asarray(self.buffer_rgba())
118-
slice_y,slice_x=cbook._get_nonzero_slices(orig_img[...,3])
119-
return (slice_x.start,slice_y.start,
120-
slice_x.stop-slice_x.start,slice_y.stop-slice_y.start)
121-
122-
@_api.deprecated("3.4")
123-
deftostring_rgba_minimized(self):
124-
extents=self.get_content_extents()
125-
bbox= [[extents[0],self.height- (extents[1]+extents[3])],
126-
[extents[0]+extents[2],self.height-extents[1]]]
127-
region=self.copy_from_bbox(bbox)
128-
returnnp.array(region),extents
129-
130115
defdraw_path(self,gc,path,transform,rgbFace=None):
131116
# docstring inherited
132117
nmax=mpl.rcParams['agg.path.chunksize']# here at least for testing

‎lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2738,13 +2738,10 @@ class FigureCanvasPdf(FigureCanvasBase):
27382738
defget_default_filetype(self):
27392739
return'pdf'
27402740

2741-
@_api.delete_parameter("3.4","dpi")
27422741
defprint_pdf(self,filename,*,
2743-
dpi=None,# dpi to use for images
27442742
bbox_inches_restore=None,metadata=None):
27452743

2746-
ifdpiisNone:# always use this branch after deprecation elapses.
2747-
dpi=self.figure.get_dpi()
2744+
dpi=self.figure.get_dpi()
27482745
self.figure.set_dpi(72)# there are 72 pdf points to an inch
27492746
width,height=self.figure.get_size_inches()
27502747
ifisinstance(filename,PdfPages):

‎lib/matplotlib/backends/backend_pgf.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -771,31 +771,6 @@ def points_to_pixels(self, points):
771771
returnpoints*mpl_pt_to_in*self.dpi
772772

773773

774-
@_api.deprecated("3.4")
775-
classTmpDirCleaner:
776-
_remaining_tmpdirs=set()
777-
778-
@_api.classproperty
779-
@_api.deprecated("3.4")
780-
defremaining_tmpdirs(cls):
781-
returncls._remaining_tmpdirs
782-
783-
@staticmethod
784-
@_api.deprecated("3.4")
785-
defadd(tmpdir):
786-
TmpDirCleaner._remaining_tmpdirs.add(tmpdir)
787-
788-
@staticmethod
789-
@_api.deprecated("3.4")
790-
@atexit.register
791-
defcleanup_remaining_tmpdirs():
792-
fortmpdirinTmpDirCleaner._remaining_tmpdirs:
793-
error_message="error deleting tmp directory {}".format(tmpdir)
794-
shutil.rmtree(
795-
tmpdir,
796-
onerror=lambda*args:_log.error(error_message))
797-
798-
799774
classFigureCanvasPgf(FigureCanvasBase):
800775
filetypes= {"pgf":"LaTeX PGF picture",
801776
"pdf":"LaTeX compiled PGF picture",

‎lib/matplotlib/backends/backend_ps.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -806,15 +806,6 @@ def _draw_ps(self, ps, gc, rgbFace, *, fill=True, stroke=True):
806806
write("grestore\n")
807807

808808

809-
@_api.deprecated("3.4",alternative="GraphicsContextBase")
810-
classGraphicsContextPS(GraphicsContextBase):
811-
defget_capstyle(self):
812-
return {'butt':0,'round':1,'projecting':2}[super().get_capstyle()]
813-
814-
defget_joinstyle(self):
815-
return {'miter':0,'round':1,'bevel':2}[super().get_joinstyle()]
816-
817-
818809
class_Orientation(Enum):
819810
portrait,landscape=range(2)
820811

@@ -830,15 +821,13 @@ class FigureCanvasPS(FigureCanvasBase):
830821
defget_default_filetype(self):
831822
return'ps'
832823

833-
@_api.delete_parameter("3.4","dpi")
834824
@_api.delete_parameter("3.5","args")
835825
def_print_ps(
836826
self,fmt,outfile,*args,
837-
dpi=None,metadata=None,papertype=None,orientation='portrait',
827+
metadata=None,papertype=None,orientation='portrait',
838828
**kwargs):
839829

840-
ifdpiisNone:# always use this branch after deprecation elapses.
841-
dpi=self.figure.get_dpi()
830+
dpi=self.figure.get_dpi()
842831
self.figure.set_dpi(72)# Override the dpi kwarg
843832

844833
dsc_comments= {}

‎lib/matplotlib/backends/backend_svg.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,9 +1281,8 @@ class FigureCanvasSVG(FigureCanvasBase):
12811281

12821282
fixed_dpi=72
12831283

1284-
@_api.delete_parameter("3.4","dpi")
12851284
@_api.delete_parameter("3.5","args")
1286-
defprint_svg(self,filename,*args,dpi=None,bbox_inches_restore=None,
1285+
defprint_svg(self,filename,*args,bbox_inches_restore=None,
12871286
metadata=None):
12881287
"""
12891288
Parameters
@@ -1319,8 +1318,7 @@ def print_svg(self, filename, *args, dpi=None, bbox_inches_restore=None,
13191318
withcbook.open_file_cm(filename,"w",encoding="utf-8")asfh:
13201319
ifnotcbook.file_requires_unicode(fh):
13211320
fh=codecs.getwriter('utf-8')(fh)
1322-
ifdpiisNone:# always use this branch after deprecation elapses
1323-
dpi=self.figure.get_dpi()
1321+
dpi=self.figure.get_dpi()
13241322
self.figure.set_dpi(72)
13251323
width,height=self.figure.get_size_inches()
13261324
w,h=width*72,height*72

‎lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040

4141
@_api.caching_module_getattr# module-level deprecations
4242
class__getattr__:
43-
IDLE_DELAY=_api.deprecated("3.1",obj_type="",removal="3.6")(property(
44-
lambdaself:5))
4543
cursord=_api.deprecated("3.5",obj_type="")(property(lambdaself: {
4644
cursors.MOVE:wx.CURSOR_HAND,
4745
cursors.HAND:wx.CURSOR_HAND,
@@ -593,8 +591,7 @@ def _get_imagesave_wildcards(self):
593591
wildcards='|'.join(wildcards)
594592
returnwildcards,extensions,filter_index
595593

596-
@_api.delete_parameter("3.4","origin")
597-
defgui_repaint(self,drawDC=None,origin='WX'):
594+
defgui_repaint(self,drawDC=None):
598595
"""
599596
Update the displayed image on the GUI canvas, using the supplied
600597
wx.PaintDC device context.
@@ -1084,10 +1081,6 @@ def _icon(name):
10841081
returnwx.Bitmap.FromBufferRGBA(
10851082
image.shape[1],image.shape[0],image.tobytes())
10861083

1087-
@_api.deprecated("3.4")
1088-
defget_canvas(self,frame,fig):
1089-
returntype(self.canvas)(frame,-1,fig)
1090-
10911084
def_update_buttons_checked(self):
10921085
if"Pan"inself.wx_ids:
10931086
self.ToggleTool(self.wx_ids["Pan"],self.mode.name=="PAN")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp