155 lines
4.0 KiB
Diff
155 lines
4.0 KiB
Diff
|
From 1108bd9d23460c5e46744b873f6a7caf83089958 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Kowalik <steven@wedontsleep.org>
|
||
|
Date: Thu, 11 Aug 2022 16:53:46 +1000
|
||
|
Subject: [PATCH] Drop use of contextlib2
|
||
|
|
||
|
As of Python 3.7, contextlib in the standard library now supports all
|
||
|
functionality that this library requires. As a consequence, remove the
|
||
|
external requirement, and switch to it. Drive by removing some now
|
||
|
unneeded __future__ imports.
|
||
|
---
|
||
|
.github/environment-ci.yml | 1 -
|
||
|
.github/environment-minimal.yml | 1 -
|
||
|
librosa/version.py | 1 -
|
||
|
setup.cfg | 1 -
|
||
|
tests/test_beat.py | 4 +---
|
||
|
tests/test_effects.py | 2 +-
|
||
|
tests/test_filters.py | 2 +-
|
||
|
tests/test_multichannel.py | 4 +---
|
||
|
tests/test_onset.py | 3 +--
|
||
|
9 files changed, 5 insertions(+), 14 deletions(-)
|
||
|
|
||
|
diff --git a/.github/environment-ci.yml b/.github/environment-ci.yml
|
||
|
index 444898d1d3..5018ab6dde 100644
|
||
|
--- a/.github/environment-ci.yml
|
||
|
+++ b/.github/environment-ci.yml
|
||
|
@@ -22,7 +22,6 @@ dependencies:
|
||
|
- pytest-mpl
|
||
|
- pytest-cov
|
||
|
- pytest
|
||
|
- - contextlib2
|
||
|
- coverage
|
||
|
- ffmpeg
|
||
|
- pip:
|
||
|
diff --git a/.github/environment-minimal.yml b/.github/environment-minimal.yml
|
||
|
index 98ddc7b99c..12d24d36af 100644
|
||
|
--- a/.github/environment-minimal.yml
|
||
|
+++ b/.github/environment-minimal.yml
|
||
|
@@ -22,7 +22,6 @@ dependencies:
|
||
|
- pytest-mpl
|
||
|
- pytest-cov
|
||
|
- pytest
|
||
|
- - contextlib2
|
||
|
- coverage
|
||
|
- ffmpeg
|
||
|
- tomli<2.0
|
||
|
diff --git a/librosa/version.py b/librosa/version.py
|
||
|
index 14b00bf7de..4b979c2f11 100644
|
||
|
--- a/librosa/version.py
|
||
|
+++ b/librosa/version.py
|
||
|
@@ -57,7 +57,6 @@ def show_versions():
|
||
|
"matplotlib",
|
||
|
"samplerate",
|
||
|
"soxr",
|
||
|
- "contextlib2",
|
||
|
"presets",
|
||
|
]
|
||
|
|
||
|
diff --git a/setup.cfg b/setup.cfg
|
||
|
index ab848a79a2..f6b4ad2b3c 100644
|
||
|
--- a/setup.cfg
|
||
|
+++ b/setup.cfg
|
||
|
@@ -77,7 +77,6 @@ tests =
|
||
|
pytest-mpl
|
||
|
pytest-cov
|
||
|
pytest
|
||
|
- contextlib2
|
||
|
samplerate
|
||
|
soxr
|
||
|
display =
|
||
|
diff --git a/tests/test_beat.py b/tests/test_beat.py
|
||
|
index 0aad1bb1c0..4d38e71683 100644
|
||
|
--- a/tests/test_beat.py
|
||
|
+++ b/tests/test_beat.py
|
||
|
@@ -2,8 +2,6 @@
|
||
|
# CREATED:2013-03-11 18:14:30 by Brian McFee <brm2132@columbia.edu>
|
||
|
# unit tests for librosa.beat
|
||
|
|
||
|
-from __future__ import print_function
|
||
|
-
|
||
|
# Disable cache
|
||
|
import os
|
||
|
|
||
|
@@ -13,7 +11,7 @@
|
||
|
pass
|
||
|
|
||
|
import pytest
|
||
|
-from contextlib2 import nullcontext as dnr
|
||
|
+from contextlib import nullcontext as dnr
|
||
|
|
||
|
import numpy as np
|
||
|
import scipy.stats
|
||
|
diff --git a/tests/test_effects.py b/tests/test_effects.py
|
||
|
index f7d24130e7..2cdc65b08b 100644
|
||
|
--- a/tests/test_effects.py
|
||
|
+++ b/tests/test_effects.py
|
||
|
@@ -11,7 +11,7 @@
|
||
|
except KeyError:
|
||
|
pass
|
||
|
|
||
|
-from contextlib2 import nullcontext as dnr
|
||
|
+from contextlib import nullcontext as dnr
|
||
|
import numpy as np
|
||
|
import pytest
|
||
|
|
||
|
diff --git a/tests/test_filters.py b/tests/test_filters.py
|
||
|
index 59e351d3e0..f2c1a344bd 100644
|
||
|
--- a/tests/test_filters.py
|
||
|
+++ b/tests/test_filters.py
|
||
|
@@ -19,7 +19,7 @@
|
||
|
except KeyError:
|
||
|
pass
|
||
|
|
||
|
-from contextlib2 import nullcontext as dnr
|
||
|
+from contextlib import nullcontext as dnr
|
||
|
import glob
|
||
|
import numpy as np
|
||
|
import scipy.io
|
||
|
diff --git a/tests/test_multichannel.py b/tests/test_multichannel.py
|
||
|
index d927233321..94a5c72a99 100644
|
||
|
--- a/tests/test_multichannel.py
|
||
|
+++ b/tests/test_multichannel.py
|
||
|
@@ -3,8 +3,6 @@
|
||
|
# unit tests for multi-channel functionality
|
||
|
#
|
||
|
|
||
|
-from __future__ import print_function
|
||
|
-
|
||
|
# Disable cache
|
||
|
import os
|
||
|
|
||
|
@@ -21,7 +19,7 @@
|
||
|
import warnings
|
||
|
from unittest import mock
|
||
|
|
||
|
-from contextlib2 import nullcontext as dnr
|
||
|
+from contextlib import nullcontext as dnr
|
||
|
from test_core import srand
|
||
|
|
||
|
|
||
|
diff --git a/tests/test_onset.py b/tests/test_onset.py
|
||
|
index f74fe9e22d..91c97dc734 100644
|
||
|
--- a/tests/test_onset.py
|
||
|
+++ b/tests/test_onset.py
|
||
|
@@ -2,9 +2,8 @@
|
||
|
# CREATED:2013-03-11 18:14:30 by Brian McFee <brm2132@columbia.edu>
|
||
|
# unit tests for librosa.onset
|
||
|
|
||
|
-from __future__ import print_function
|
||
|
import pytest
|
||
|
-from contextlib2 import nullcontext as dnr
|
||
|
+from contextlib import nullcontext as dnr
|
||
|
|
||
|
# Disable cache
|
||
|
import os
|