From 130cba01667f7391e4c4fc50fd249988d5ce2420 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 27 Mar 2018 21:16:01 -0700 Subject: [PATCH] No need to mark (unicode) strings as u"foo" anymore. --- lib/matplotlib/_mathtext_data.py | 10 +++++----- lib/matplotlib/tests/test_arrow_patches.py | 2 +- lib/matplotlib/tests/test_backend_pdf.py | 2 +- lib/matplotlib/tests/test_mathtext.py | 2 +- lib/matplotlib/type1font.py | 2 +- tools/github_stats.py | 12 ++++-------- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/lib/matplotlib/_mathtext_data.py b/lib/matplotlib/_mathtext_data.py index 269cc68e8388..baefe1b7eb72 100644 --- a/lib/matplotlib/_mathtext_data.py +++ b/lib/matplotlib/_mathtext_data.py @@ -281,7 +281,7 @@ r'\rho' : ('psyr', 114), r'\sigma' : ('psyr', 115), r'\tau' : ('psyr', 116), - '\\upsilon' : ('psyr', 117), + r'\upsilon' : ('psyr', 117), r'\varpi' : ('psyr', 118), r'\omega' : ('psyr', 119), r'\xi' : ('psyr', 120), @@ -296,7 +296,7 @@ r'\spadesuit' : ('psyr', 170), r'\leftrightarrow' : ('psyr', 171), r'\leftarrow' : ('psyr', 172), - '\\uparrow' : ('psyr', 173), + r'\uparrow' : ('psyr', 173), r'\rightarrow' : ('psyr', 174), r'\downarrow' : ('psyr', 175), r'\pm' : ('psyr', 176), @@ -335,12 +335,12 @@ r'\surd' : ('psyr', 214), r'\__sqrt__' : ('psyr', 214), r'\cdot' : ('psyr', 215), - '\\urcorner' : ('psyr', 216), + r'\urcorner' : ('psyr', 216), r'\vee' : ('psyr', 217), r'\wedge' : ('psyr', 218), r'\Leftrightarrow' : ('psyr', 219), r'\Leftarrow' : ('psyr', 220), - '\\Uparrow' : ('psyr', 221), + r'\Uparrow' : ('psyr', 221), r'\Rightarrow' : ('psyr', 222), r'\Downarrow' : ('psyr', 223), r'\Diamond' : ('psyr', 224), @@ -362,7 +362,7 @@ r'\slash' : ('psyr', 0o57), r'\Lamda' : ('psyr', 0o114), r'\neg' : ('psyr', 0o330), - '\\Upsilon' : ('psyr', 0o241), + r'\Upsilon' : ('psyr', 0o241), r'\rightbrace' : ('psyr', 0o175), r'\rfloor' : ('psyr', 0o373), r'\lambda' : ('psyr', 0o154), diff --git a/lib/matplotlib/tests/test_arrow_patches.py b/lib/matplotlib/tests/test_arrow_patches.py index 44f87c5fe59a..73fadd6cf2c1 100644 --- a/lib/matplotlib/tests/test_arrow_patches.py +++ b/lib/matplotlib/tests/test_arrow_patches.py @@ -62,7 +62,7 @@ def __prepare_fancyarrow_dpi_cor_test(): ax.set_xlim([0, 1]) ax.set_ylim([0, 1]) ax.add_patch(mpatches.FancyArrowPatch(posA=(0.3, 0.4), posB=(0.8, 0.6), - lw=3, arrowstyle=u'->', + lw=3, arrowstyle='->', mutation_scale=100)) return fig2 diff --git a/lib/matplotlib/tests/test_backend_pdf.py b/lib/matplotlib/tests/test_backend_pdf.py index 05a1e4b81141..b1407243e525 100644 --- a/lib/matplotlib/tests/test_backend_pdf.py +++ b/lib/matplotlib/tests/test_backend_pdf.py @@ -28,7 +28,7 @@ def test_use14corefonts(): rcParams['font.sans-serif'] = ['Helvetica'] rcParams['pdf.compression'] = 0 - text = u'''A three-line text positioned just above a blue line + text = '''A three-line text positioned just above a blue line and containing some French characters and the euro symbol: "Merci pépé pour les 10 €"''' diff --git a/lib/matplotlib/tests/test_mathtext.py b/lib/matplotlib/tests/test_mathtext.py index cdc1093e1417..58a0af8c72ef 100644 --- a/lib/matplotlib/tests/test_mathtext.py +++ b/lib/matplotlib/tests/test_mathtext.py @@ -86,7 +86,7 @@ # mathtex doesn't support array # 'mmltt23' : r'$\left(\begin{array}{cc}\hfill \left(\begin{array}{cc}\hfill a\hfill & \hfill b\hfill \\ \hfill c\hfill & \hfill d\hfill \end{array}\right)\hfill & \hfill \left(\begin{array}{cc}\hfill e\hfill & \hfill f\hfill \\ \hfill g\hfill & \hfill h\hfill \end{array}\right)\hfill \\ \hfill 0\hfill & \hfill \left(\begin{array}{cc}\hfill i\hfill & \hfill j\hfill \\ \hfill k\hfill & \hfill l\hfill \end{array}\right)\hfill \end{array}\right)$', # mathtex doesn't support array - # 'mmltt24' : u'$det|\\begin{array}{ccccc}\\hfill {c}_{0}\\hfill & \\hfill {c}_{1}\\hfill & \\hfill {c}_{2}\\hfill & \\hfill \\dots \\hfill & \\hfill {c}_{n}\\hfill \\\\ \\hfill {c}_{1}\\hfill & \\hfill {c}_{2}\\hfill & \\hfill {c}_{3}\\hfill & \\hfill \\dots \\hfill & \\hfill {c}_{n+1}\\hfill \\\\ \\hfill {c}_{2}\\hfill & \\hfill {c}_{3}\\hfill & \\hfill {c}_{4}\\hfill & \\hfill \\dots \\hfill & \\hfill {c}_{n+2}\\hfill \\\\ \\hfill \\u22ee\\hfill & \\hfill \\u22ee\\hfill & \\hfill \\u22ee\\hfill & \\hfill \\hfill & \\hfill \\u22ee\\hfill \\\\ \\hfill {c}_{n}\\hfill & \\hfill {c}_{n+1}\\hfill & \\hfill {c}_{n+2}\\hfill & \\hfill \\dots \\hfill & \\hfill {c}_{2n}\\hfill \\end{array}|>0$', + # 'mmltt24' : r'$det|\begin{array}{ccccc}\hfill {c}_{0}\hfill & \hfill {c}_{1}\hfill & \hfill {c}_{2}\hfill & \hfill \dots \hfill & \hfill {c}_{n}\hfill \\ \hfill {c}_{1}\hfill & \hfill {c}_{2}\hfill & \hfill {c}_{3}\hfill & \hfill \dots \hfill & \hfill {c}_{n+1}\hfill \\ \hfill {c}_{2}\hfill & \hfill {c}_{3}\hfill & \hfill {c}_{4}\hfill & \hfill \dots \hfill & \hfill {c}_{n+2}\hfill \\ \hfill \u22ee\hfill & \hfill \u22ee\hfill & \hfill \u22ee\hfill & \hfill \hfill & \hfill \u22ee\hfill \\ \hfill {c}_{n}\hfill & \hfill {c}_{n+1}\hfill & \hfill {c}_{n+2}\hfill & \hfill \dots \hfill & \hfill {c}_{2n}\hfill \end{array}|>0$', r'${y}_{{x}_{2}}$', r'${x}_{92}^{31415}+\pi $', r'${x}_{{y}_{b}^{a}}^{{z}_{c}^{d}}$', diff --git a/lib/matplotlib/type1font.py b/lib/matplotlib/type1font.py index 35a6267e26e2..62d316390d9c 100644 --- a/lib/matplotlib/type1font.py +++ b/lib/matplotlib/type1font.py @@ -275,7 +275,7 @@ def fontmatrix(array): newmatrix = np.dot(modifier, oldmatrix) array[::2] = newmatrix[0:3, 0] array[1::2] = newmatrix[0:3, 1] - as_string = u'[' + u' '.join(str(x) for x in array) + u']' + as_string = '[' + ' '.join(str(x) for x in array) + ']' return as_string.encode('latin-1') def replace(fun): diff --git a/tools/github_stats.py b/tools/github_stats.py index bab4d7649dcb..df49808a9b99 100755 --- a/tools/github_stats.py +++ b/tools/github_stats.py @@ -99,21 +99,17 @@ def report(issues, show_urls=False): if show_urls: for i in issues: role = 'ghpull' if 'merged_at' in i else 'ghissue' - print(u'* :%s:`%d`: %s' % (role, i['number'], - i['title'].replace(u'`', u'``'))) + print('* :%s:`%d`: %s' % (role, i['number'], + i['title'].replace('`', '``'))) else: for i in issues: - print(u'* %d: %s' % (i['number'], i['title'].replace(u'`', u'``'))) + print('* %d: %s' % (i['number'], i['title'].replace('`', '``'))) #----------------------------------------------------------------------------- # Main script #----------------------------------------------------------------------------- if __name__ == "__main__": - # deal with unicode - if sys.version_info < (3,): - sys.stdout = codecs.getwriter('utf8')(sys.stdout) - # Whether to add reST urls for all issues in printout. show_urls = True @@ -211,7 +207,7 @@ def report(issues, show_urls=False): ncommits = len(pr_authors) + ncommits - len(pulls) author_cmd = ['git', 'check-mailmap'] + pr_authors with_email = check_output(author_cmd).decode('utf-8', 'replace').splitlines() - all_authors.extend([ u'* ' + a.split(' <')[0] for a in with_email ]) + all_authors.extend(['* ' + a.split(' <')[0] for a in with_email]) unique_authors = sorted(set(all_authors), key=lambda s: s.lower()) print("We closed %d issues and merged %d pull requests." % (n_issues, n_pulls))