Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2df1c54

Browse files
authored
Merge pull request #16601 from anntzer/cleanup
Small unrelated cleanups.
2 parents ac0bd8f + 29ec269 commit 2df1c54

File tree

4 files changed

+7
-16
lines changed

4 files changed

+7
-16
lines changed

doc/sphinxext/missing_references.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ def _truncate_location(location):
139139
This allows for easy comparison even when line numbers chagne
140140
(as they do regularily).
141141
"""
142-
if ":" in location:
143-
return location.split(":", 1)[0]
144-
return location
142+
return location.split(":", 1)[0]
145143

146144

147145
def _warn_unused_missing_references(app):

lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,8 +538,7 @@ def __init__(self, filename, metadata=None):
538538
self.pageAnnotations = [] # A list of annotations for the current page
539539

540540
# The PDF spec recommends to include every procset
541-
procsets = [Name(x)
542-
for x in "PDF Text ImageB ImageC ImageI".split()]
541+
procsets = [Name(x) for x in "PDF Text ImageB ImageC ImageI".split()]
543542

544543
# Write resource dictionary.
545544
# Possibly TODO: more general ExtGState (graphics state dictionaries)

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -916,10 +916,7 @@ def print_figure_impl(fh):
916916
Ndict += len(ps_renderer._character_tracker.used)
917917
print("/mpldict %d dict def" % Ndict, file=fh)
918918
print("mpldict begin", file=fh)
919-
for d in psDefs:
920-
d = d.strip()
921-
for l in d.split('\n'):
922-
print(l.strip(), file=fh)
919+
print("\n".join(psDefs), file=fh)
923920
if not mpl.rcParams['ps.useafm']:
924921
for font_path, chars \
925922
in ps_renderer._character_tracker.used.items():

lib/matplotlib/rcsetup.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -718,13 +718,10 @@ def validate_sketch(s):
718718
s = s.lower()
719719
if s == 'none' or s is None:
720720
return None
721-
if isinstance(s, str):
722-
result = tuple([float(v.strip()) for v in s.split(',')])
723-
elif isinstance(s, (list, tuple)):
724-
result = tuple([float(v) for v in s])
725-
if len(result) != 3:
726-
raise ValueError("path.sketch must be a tuple (scale, length, randomness)")
727-
return result
721+
try:
722+
return tuple(validate_nseq_float(3)(s))
723+
except ValueError:
724+
raise ValueError("Expected a (scale, length, randomness) triplet")
728725

729726

730727
def _validate_greaterequal0_lessthan1(s):

0 commit comments

Comments
 (0)