Skip to content

Remove Python 3.6 compatibility shims #17883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@
import threading
except ImportError:
import dummy_threading as threading
try:
from contextlib import nullcontext
except ImportError:
from contextlib import ExitStack as nullcontext # Py 3.6.
from contextlib import nullcontext
from math import radians, cos, sin

import numpy as np
Expand Down
5 changes: 1 addition & 4 deletions lib/matplotlib/backends/backend_gtk3cairo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from contextlib import nullcontext
except ImportError:
from contextlib import ExitStack as nullcontext # Py 3.6.
from contextlib import nullcontext

from . import backend_cairo, backend_gtk3
from .backend_gtk3 import Gtk, _BackendGTK3
Expand Down
7 changes: 2 additions & 5 deletions lib/matplotlib/testing/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
import sys
import unittest
import warnings
try:
from contextlib import nullcontext
except ImportError:
from contextlib import ExitStack as nullcontext # Py3.6.

import matplotlib as mpl
import matplotlib.style
Expand Down Expand Up @@ -219,7 +215,8 @@ def compare(self, idx, baseline, extension, *, _lock=False):
{'Creator': None, 'Producer': None,
'CreationDate': None})

lock = cbook._lock_path(actual_path) if _lock else nullcontext()
lock = (cbook._lock_path(actual_path)
if _lock else contextlib.nullcontext())
with lock:
fig.savefig(actual_path, **kwargs)
expected_path = self.copy_baseline(baseline, extension)
Expand Down
5 changes: 1 addition & 4 deletions lib/matplotlib/tests/test_figure.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from contextlib import nullcontext
from datetime import datetime
import io
from pathlib import Path
import platform
from types import SimpleNamespace
import warnings
try:
from contextlib import nullcontext
except ImportError:
from contextlib import ExitStack as nullcontext # Py3.6

import matplotlib as mpl
from matplotlib import cbook, rcParams
Expand Down
5 changes: 1 addition & 4 deletions lib/matplotlib/tests/test_ticker.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
from contextlib import nullcontext
except ImportError:
from contextlib import ExitStack as nullcontext # Py 3.6.
from contextlib import nullcontext
import re
import itertools

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ def build_extensions(self):
'License :: OSI Approved :: Python Software Foundation License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Scientific/Engineering :: Visualization',
],

Expand Down