8000 Add an api change note · matplotlib/matplotlib@3f45960 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3f45960

8000 Browse files
committed
Add an api change note
and name the new members like _foo_seq to make them obviously private and to conform to PEP8
1 parent d135d87 commit 3f45960

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Removals
2+
````````
3+
4+
The following members of ``matplotlib.backends.backend_pdf.PdfFile`` were removed:
5+
6+
- ``nextObject``
7+
- ``nextFont``
8+
- ``nextAlphaState``
9+
- ``nextHatch``
10+
- ``nextImage``

lib/matplotlib/backends/backend_pdf.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ def __init__(self, filename, metadata=None):
453453
for `'Creator'`, `'Producer'` and `'CreationDate'`. They
454454
can be removed by setting them to `None`.
455455
"""
456-
self.objectId = itertools.count(1) # consumed by reserveObject
456+
self._object_seq = itertools.count(1) # consumed by reserveObject
457457
self.xrefTable = [[0, 65535, 'the zero object']]
458458
self.passed_in_file_object = False
459459
self.original_file_like = None
@@ -511,21 +511,21 @@ def __init__(self, filename, metadata=None):
511511
if v is not None}
512512

513513
self.fontNames = {} # maps filenames to internal font names
514-
self.internalFontName = (Name(f'F{i}') for i in itertools.count(1))
514+
self._internal_font_seq = (Name(f'F{i}') for i in itertools.count(1))
515515
self.dviFontInfo = {} # maps dvi font names to embedding information
516516
# differently encoded Type-1 fonts may share the same descriptor
517517
self.type1Descriptors = {}
518518
self.used_characters = {}
519519

520520
self.alphaStates = {} # maps alpha values to graphics state objects
521-
self.alphaStateName = (Name(f'A{i}') for i in itertools.count(1))
521+
self._alpha_state_seq = (Name(f'A{i}') for i in itertools.count(1))
522522
# reproducible writeHatches needs an ordered dict:
523523
self.hatchPatterns = collections.OrderedDict()
524-
self.hatchPatternName = (Name(f'H{i}') for i in itertools.count(1))
524+
self._hatch_pattern_seq = (Name(f'H{i}') for i in itertools.count(1))
525525
self.gouraudTriangles = []
526526

527527
self._images = collections.OrderedDict() # reproducible writeImages
528-
self.imageName = (Name(f'I{i}') for i in itertools.count(1))
528+
self._image_seq = (Name(f'I{i}') for i in itertools.count(1))
529529

530530
self.markers = collections.OrderedDict() # reproducible writeMarkers
531531
self.multi_byte_charprocs = {}
@@ -672,7 +672,7 @@ def fontName(self, fontprop):
672672

673673
Fx = self.fontNames.get(filename)
674674
if Fx is None:
675-
Fx = next(self.internalFontName)
675+
Fx = next(self._internal_font_seq)
676676
self.fontNames[filename] = Fx
677677
_log.debug('Assigning font %s = %r', Fx, filename)
678678

@@ -697,7 +697,7 @@ def dviFontName(self, dvifont):
697697
"the font may lack a Type-1 version"
698698
.format(psfont.psname, dvifont.texname))
699699

700-
pdfname = next(self.internalFontName)
700+
pdfname = next(self._internal_font_seq)
701701
_log.debug('Assigning font %s = %s (dvi)', pdfname, dvifont.texname)
702702
self.dviFontInfo[dvifont.texname] = types.SimpleNamespace(
703703
dvifont=dvifont,
@@ -1213,7 +1213,7 @@ def alphaState(self, alpha):
12131213
if state is not None:
12141214
return state[0]
12151215

1216-
name = next(self.alphaStateName)
1216+
name = next(self._alpha_state_seq)
12171217
self.alphaStates[alpha] = \
12181218
(name, {'Type': Name('ExtGState'),
12191219
'CA': alpha[0], 'ca': alpha[1]})
@@ -1233,7 +1233,7 @@ def hatchPattern(self, hatch_style):
12331233
if pattern is not None:
12341234
return pattern
12351235

1236-
name = next(self.hatchPatternName)
1236+
name = next(self._hatch_pattern_seq)
12371237
self.hatchPatterns[hatch_style] = name
12381238
return name
12391239

@@ -1325,7 +1325,7 @@ def imageObject(self, image):
13251325
if entry is not None:
13261326
return entry[1]
13271327

1328-
name = next(self.imageName)
1328+
name = next(self._image_seq)
13291329
ob = self.reserveObject(f'image {name}')
13301330
self._images[id(image)] = (image, name, ob)
13311331
return name
@@ -1519,7 +1519,7 @@ def reserveObject(self, name=''):
15191519
the object with writeObject.
15201520
"""
15211521

1522-
id = next(self.objectId)
1522+
id = next(self._object_seq)
15231523
self.xrefTable.append([None, 0, name])
15241524
return Reference(id)
15251525

0 commit comments

Comments
 (0)
0