summarylogtreecommitdiffstats
path: root/0003-Use-collections.abc.patch
blob: bf24167f7362f077ab46d91e39fcc95d4ad0d69d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 25684c38ae82390ac5801a681cd459f882b093f2 Mon Sep 17 00:00:00 2001
From: Freek Dijkstra <freek@macfreek.nl>
Date: Tue, 26 Oct 2021 00:42:37 +0200
Subject: [PATCH 3/3] Use collections.abc. With fall-back for outdated Pyton
 2.7 versions.

---
 nbt/nbt.py    | 5 ++++-
 nbt/region.py | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/nbt/nbt.py b/nbt/nbt.py
index feb6d00..861a385 100644
--- a/nbt/nbt.py
+++ b/nbt/nbt.py
@@ -7,7 +7,10 @@ https://minecraft.gamepedia.com/NBT_format
 
 from struct import Struct, error as StructError
 from gzip import GzipFile
-from typing import MutableMapping, MutableSequence, Sequence
+try:
+    from collections.abc import MutableMapping, MutableSequence, Sequence
+except ImportError:  # for Python 2.7
+    from collections import MutableMapping, MutableSequence, Sequence
 import sys
 
 _PY3 = sys.version_info >= (3,)
diff --git a/nbt/region.py b/nbt/region.py
index d52b861..224099b 100644
--- a/nbt/region.py
+++ b/nbt/region.py
@@ -7,7 +7,10 @@ https://minecraft.gamepedia.com/Region_file_format
 
 from .nbt import NBTFile, MalformedFileError
 from struct import pack, unpack
-from typing import Mapping
+try:
+    from collections.abc import Mapping
+except ImportError:  # for Python 2.7
+    from collections import Mapping
 import zlib
 import gzip
 from io import BytesIO
-- 
2.34.1