|
|
0695a7b |
From adf06fdb2a5896ba07ac4438b307f0870b57427e Mon Sep 17 00:00:00 2001
|
|
|
0695a7b |
From: "Ankur Sinha (Ankur Sinha Gmail)" <sanjay.ankur@gmail.com>
|
|
|
0695a7b |
Date: Wed, 18 Aug 2021 19:23:27 +0100
|
|
|
0695a7b |
Subject: [PATCH] fix(py3.10) correct collections import
|
|
|
0695a7b |
|
|
|
0695a7b |
---
|
|
|
0695a7b |
pyphi/db.py | 5 ++++-
|
|
|
0695a7b |
pyphi/labels.py | 2 +-
|
|
|
0695a7b |
pyphi/models/actual_causation.py | 2 +-
|
|
|
0695a7b |
pyphi/models/cmp.py | 5 ++++-
|
|
|
0695a7b |
pyphi/models/cuts.py | 2 +-
|
|
|
0695a7b |
pyphi/models/subsystem.py | 2 +-
|
|
|
0695a7b |
pyphi/registry.py | 2 +-
|
|
|
0695a7b |
7 files changed, 13 insertions(+), 7 deletions(-)
|
|
|
0695a7b |
|
|
|
0695a7b |
diff --git a/pyphi/db.py b/pyphi/db.py
|
|
|
0695a7b |
index f1df5d15..8352dfe8 100644
|
|
|
0695a7b |
--- a/pyphi/db.py
|
|
|
0695a7b |
+++ b/pyphi/db.py
|
|
|
0695a7b |
@@ -7,7 +7,10 @@ Interface to MongoDB that exposes it as a key-value store.
|
|
|
0695a7b |
"""
|
|
|
0695a7b |
|
|
|
0695a7b |
import pickle
|
|
|
0695a7b |
-from collections import Iterable
|
|
|
0695a7b |
+try:
|
|
|
0695a7b |
+ from collections import Iterable
|
|
|
0695a7b |
+except ImportError:
|
|
|
0695a7b |
+ from collections.abc import Iterable
|
|
|
0695a7b |
|
|
|
0695a7b |
import pymongo
|
|
|
0695a7b |
from bson.binary import Binary
|
|
|
0695a7b |
diff --git a/pyphi/labels.py b/pyphi/labels.py
|
|
|
0695a7b |
index 14400aef..800be2a6 100644
|
|
|
0695a7b |
--- a/pyphi/labels.py
|
|
|
0695a7b |
+++ b/pyphi/labels.py
|
|
|
0695a7b |
@@ -22,7 +22,7 @@ def default_labels(indices):
|
|
|
0695a7b |
return tuple(default_label(i) for i in indices)
|
|
|
0695a7b |
|
|
|
0695a7b |
|
|
|
0695a7b |
-class NodeLabels(collections.Sequence):
|
|
|
0695a7b |
+class NodeLabels(collections.abc.Sequence):
|
|
|
0695a7b |
'''Text labels for nodes in a network.
|
|
|
0695a7b |
|
|
|
0695a7b |
Labels can either be instantiated as a tuple of strings:
|
|
|
0695a7b |
diff --git a/pyphi/models/actual_causation.py b/pyphi/models/actual_causation.py
|
|
|
0695a7b |
index 08416baa..d1298b05 100644
|
|
|
0695a7b |
--- a/pyphi/models/actual_causation.py
|
|
|
0695a7b |
+++ b/pyphi/models/actual_causation.py
|
|
|
0695a7b |
@@ -216,7 +216,7 @@ class Event(collections.namedtuple('Event', ['actual_cause', 'actual_effect'])):
|
|
|
0695a7b |
return self.actual_cause.mechanism
|
|
|
0695a7b |
|
|
|
0695a7b |
|
|
|
0695a7b |
-class Account(cmp.Orderable, collections.Sequence):
|
|
|
0695a7b |
+class Account(cmp.Orderable, collections.abc.Sequence):
|
|
|
0695a7b |
"""The set of |CausalLinks| with |alpha > 0|. This includes both actual
|
|
|
0695a7b |
causes and actual effects.
|
|
|
0695a7b |
"""
|
|
|
0695a7b |
diff --git a/pyphi/models/cmp.py b/pyphi/models/cmp.py
|
|
|
0695a7b |
index 5e475a7d..7b1d5f24 100644
|
|
|
0695a7b |
--- a/pyphi/models/cmp.py
|
|
|
0695a7b |
+++ b/pyphi/models/cmp.py
|
|
|
0695a7b |
@@ -7,7 +7,10 @@ Utilities for comparing phi-objects.
|
|
|
0695a7b |
"""
|
|
|
0695a7b |
|
|
|
0695a7b |
import functools
|
|
|
0695a7b |
-from collections import Iterable
|
|
|
0695a7b |
+try:
|
|
|
0695a7b |
+ from collections import Iterable
|
|
|
0695a7b |
+except ImportError:
|
|
|
0695a7b |
+ from collections.abc import Iterable
|
|
|
0695a7b |
|
|
|
0695a7b |
import numpy as np
|
|
|
0695a7b |
|
|
|
0695a7b |
diff --git a/pyphi/models/cuts.py b/pyphi/models/cuts.py
|
|
|
0695a7b |
index 7c461f9c..95cccd44 100644
|
|
|
0695a7b |
--- a/pyphi/models/cuts.py
|
|
|
0695a7b |
+++ b/pyphi/models/cuts.py
|
|
|
0695a7b |
@@ -266,7 +266,7 @@ class Part(collections.namedtuple('Part', ['mechanism', 'purview'])):
|
|
|
0695a7b |
return {'mechanism': self.mechanism, 'purview': self.purview}
|
|
|
0695a7b |
|
|
|
0695a7b |
|
|
|
0695a7b |
-class KPartition(collections.Sequence):
|
|
|
0695a7b |
+class KPartition(collections.abc.Sequence):
|
|
|
0695a7b |
"""A partition with an arbitrary number of parts."""
|
|
|
0695a7b |
|
|
|
0695a7b |
__slots__ = ['parts', 'node_labels']
|
|
|
0695a7b |
diff --git a/pyphi/models/subsystem.py b/pyphi/models/subsystem.py
|
|
|
0695a7b |
index 15c48fe0..2fcecd23 100644
|
|
|
0695a7b |
--- a/pyphi/models/subsystem.py
|
|
|
0695a7b |
+++ b/pyphi/models/subsystem.py
|
|
|
0695a7b |
@@ -17,7 +17,7 @@ def _concept_sort_key(concept):
|
|
|
0695a7b |
return (len(concept.mechanism), concept.mechanism)
|
|
|
0695a7b |
|
|
|
0695a7b |
|
|
|
0695a7b |
-class CauseEffectStructure(cmp.Orderable, collections.Sequence):
|
|
|
0695a7b |
+class CauseEffectStructure(cmp.Orderable, collections.abc.Sequence):
|
|
|
0695a7b |
"""A collection of concepts."""
|
|
|
0695a7b |
|
|
|
0695a7b |
def __init__(self, concepts=(), subsystem=None, time=None):
|
|
|
0695a7b |
diff --git a/pyphi/registry.py b/pyphi/registry.py
|
|
|
0695a7b |
index 94dda74b..cce8a4db 100644
|
|
|
0695a7b |
--- a/pyphi/registry.py
|
|
|
0695a7b |
+++ b/pyphi/registry.py
|
|
|
0695a7b |
@@ -9,7 +9,7 @@ A function registry for storing custom measures and partition strategies.
|
|
|
0695a7b |
import collections
|
|
|
0695a7b |
|
|
|
0695a7b |
|
|
|
0695a7b |
-class Registry(collections.Mapping):
|
|
|
0695a7b |
+class Registry(collections.abc.Mapping):
|
|
|
0695a7b |
"""Generic registry for user-supplied functions.
|
|
|
0695a7b |
|
|
|
0695a7b |
See ``pyphi.subsystem.PartitionRegistry`` and
|
|
|
0695a7b |
--
|
|
|
0695a7b |
2.31.1
|
|
|
0695a7b |
|