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

Commit1e68b16

Browse files
authored
Merge pull request#17297 from anntzer/getstate
Simplify pickling support.
2 parentsd1be9ad +b923ef3 commit1e68b16

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

‎lib/matplotlib/cbook/__init__.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,16 +256,6 @@ def __init__(self, type, seq=None):
256256
def__repr__(self):
257257
return'<a list of %d %s objects>'% (len(self),self.type)
258258

259-
__str__=__repr__
260-
261-
def__getstate__(self):
262-
# store a dictionary of this SilentList's state
263-
return {'type':self.type,'seq':self[:]}
264-
265-
def__setstate__(self,state):
266-
self.type=state['type']
267-
self.extend(state['seq'])
268-
269259

270260
@deprecated("3.3")
271261
classIgnoredKeywordWarning(UserWarning):

‎lib/matplotlib/gridspec.py

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -312,17 +312,7 @@ def __init__(self, nrows, ncols, figure=None,
312312
_AllowedKeys= ["left","bottom","right","top","wspace","hspace"]
313313

314314
def__getstate__(self):
315-
state=self.__dict__
316-
try:
317-
state.pop('_layoutbox')
318-
exceptKeyError:
319-
pass
320-
returnstate
321-
322-
def__setstate__(self,state):
323-
self.__dict__=state
324-
# layoutboxes don't survive pickling...
325-
self._layoutbox=None
315+
return {**self.__dict__,"_layoutbox":None}
326316

327317
defupdate(self,**kwargs):
328318
"""
@@ -580,17 +570,7 @@ def num2(self, value):
580570
self._num2=value
581571

582572
def__getstate__(self):
583-
state=self.__dict__
584-
try:
585-
state.pop('_layoutbox')
586-
exceptKeyError:
587-
pass
588-
returnstate
589-
590-
def__setstate__(self,state):
591-
self.__dict__=state
592-
# layoutboxes don't survive pickling...
593-
self._layoutbox=None
573+
return {**self.__dict__,"_layoutbox":None}
594574

595575
defget_gridspec(self):
596576
returnself._gridspec

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp