Skip to content

Commit

Permalink
isort-py: MutableSet has long been moved to collections.abc
Browse files Browse the repository at this point in the history
Use upstream patch so that this runs when any py310 uses this code.
See #1160
  • Loading branch information
nieder committed Sep 12, 2024
1 parent 6787f2f commit 62bb60b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 234b3f65a20a52ba73139d9db1f07eb4df411578 Mon Sep 17 00:00:00 2001
From: Jon Dufresne <[email protected]>
Date: Sat, 27 Oct 2018 11:01:13 -0700
Subject: [PATCH] Import from collections.abc to avoid deprecation warning

Fixes #756
---
isort/pie_slice.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/isort/pie_slice.py b/isort/pie_slice.py
index 10758bfbd..52cc24eca 100644
--- a/isort/pie_slice.py
+++ b/isort/pie_slice.py
@@ -24,6 +24,12 @@
import collections
import sys

+try:
+ from collections.abc import MutableSet
+except ImportError:
+ # Python 2.7
+ from collections import MutableSet
+
__version__ = "1.1.0"

PY2 = sys.version_info[0] == 2
@@ -381,7 +387,7 @@ def cache_clear():
from functools import lru_cache # noqa: F401


-class OrderedSet(collections.MutableSet):
+class OrderedSet(MutableSet):

def __init__(self, iterable=None):
self.end = end = []
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Package: isort-py%type_pkg[python]
Type: python (2.7 3.4 3.5 3.6 3.7 3.8 3.9 3.10)

Version: 4.3.4
Revision: 3
Revision: 4
Distribution: <<
(%type_pkg[python] = 34 ) 10.9,
(%type_pkg[python] = 34 ) 10.10,
Expand Down Expand Up @@ -42,6 +42,8 @@ using pies to achieve this without ugly hacks and/or py2to3.
Source: https://files.pythonhosted.org/packages/source/i/isort/isort-%v.tar.gz
Source-Checksum: SHA256(b9c40e9750f3d77e6e4d441d8b0266cf555e7cdabdcff33c4fd06366ca761ef8)
Depends: python%type_pkg[python], (%type_pkg[python] <= 29) futures-py%type_pkg[python]
PatchFile: %{Ni}-pr757.patch
PatchFile-MD5: db5dc5f2c321d4670f6236b52faec46e
CompileScript: <<
%p/bin/python%type_raw[python] setup.py build_ext --include-dirs=%p/include --library-dirs=%p/lib
%p/bin/python%type_raw[python] setup.py build
Expand Down

0 comments on commit 62bb60b

Please sign in to comment.