From 781884d8e885efbd5e6f4312ef7e92dc2ccb5246 Mon Sep 17 00:00:00 2001 From: Axel Tillequin Date: Sun, 15 Mar 2020 17:09:35 +0100 Subject: [PATCH] sanitize code before black --- grandalf/graphs.py | 9 +++++++-- grandalf/layouts.py | 15 ++++++++------- grandalf/routing.py | 4 ++-- grandalf/utils/dot.py | 4 ++-- grandalf/utils/geometry.py | 2 +- grandalf/utils/linalg.py | 2 +- grandalf/utils/nx.py | 4 ++++ grandalf/utils/poset.py | 2 ++ setup.py | 4 +--- tests/test_layouts.py | 13 +++++++------ 10 files changed, 35 insertions(+), 24 deletions(-) diff --git a/grandalf/graphs.py b/grandalf/graphs.py index b008b78..24e2b01 100644 --- a/grandalf/graphs.py +++ b/grandalf/graphs.py @@ -15,7 +15,6 @@ # published under GPLv2 license or EPLv1 license from .utils import Poset -from operator import attrgetter #------------------------------------------------------------------------------ @@ -133,6 +132,9 @@ def index(self): def __lt__(self,v): return 0 + def __gt__(self,v): + return 0 + def __getstate__(self): return (self.index,self.data) @@ -165,7 +167,7 @@ def __init__(self,x,y,w=1,data=None,connect=False): self.w = w self.data = data self.feedback = False - if connect and (x.c==None or y.c==None): + if connect and (x.c is None or y.c is None): c = x.c or y.c c.add_edge(self) @@ -187,6 +189,9 @@ def detach(self): def __lt__(self,v): return 0 + def __gt__(self,v): + return 0 + def __getstate__(self): xi,yi = (self.v[0].index,self.v[1].index) return (xi,yi,self.w,self.data,self.feedback) diff --git a/grandalf/layouts.py b/grandalf/layouts.py index 4f70d82..e2461c8 100644 --- a/grandalf/layouts.py +++ b/grandalf/layouts.py @@ -20,7 +20,6 @@ import importlib from bisect import bisect from sys import getrecursionlimit,setrecursionlimit -from operator import attrgetter from grandalf.utils import * @@ -154,6 +153,9 @@ class Layer(list): __x = 1. ccount = None + def __eq__(self,other): + return super().__eq__(other) + def __str__(self): s = 'um link is used for alignment if (vpair not in self.conflicts) and \ - (r==None or dirh*r