Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Commit 30bd9cb

Browse files
ewelsgtaylor
authored andcommitted
Networkx 2.0 compatibility fix by @Erotemic (#75)
1 parent aaa425a commit 30bd9cb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

colormath/color_conversions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ def get_conversion_path(self, start_type, target_type):
122122

123123
def add_type_conversion(self, start_type, target_type, conversion_function):
124124
super(GraphConversionManager, self).add_type_conversion(start_type, target_type, conversion_function)
125-
self.conversion_graph.add_edge(start_type, target_type, {'conversion_function': conversion_function})
125+
if networkx.__version__.startswith('2'):
126+
self.conversion_graph.add_edge(start_type, target_type, conversion_function=conversion_function)
127+
else:
128+
self.conversion_graph.add_edge(start_type, target_type, {'conversion_function': conversion_function})
126129

127130

128131
class DummyConversionManager(ConversionManager):

0 commit comments

Comments
 (0)