@@ -202,8 +202,7 @@ def __repr__(self):
202
202
203
203
id_re_alpha_nums = re .compile ('^[_a-zA-Z][a-zA-Z0-9_,]*$' , re .UNICODE )
204
204
id_re_alpha_nums_with_ports = re .compile (
205
- '^[_a-zA-Z][a-zA-Z0-9_,:\" ]*[a-zA-Z0-9_,\" ]+$' , re .UNICODE
206
- )
205
+ '^[_a-zA-Z][a-zA-Z0-9_,:\" ]*[a-zA-Z0-9_,\" ]+$' , re .UNICODE )
207
206
id_re_num = re .compile ('^[0-9,]+$' , re .UNICODE )
208
207
id_re_with_port = re .compile ('^([^:]*):([^:]*)$' , re .UNICODE )
209
208
id_re_dbl_quoted = re .compile ('^\" .*\" $' , re .S | re .UNICODE )
@@ -364,9 +363,7 @@ def graph_from_adjacency_matrix(matrix, node_prefix='', directed=False):
364
363
graph .add_edge (
365
364
Edge (
366
365
node_prefix + node_orig ,
367
- node_prefix + node_dest
368
- )
369
- )
366
+ node_prefix + node_dest ))
370
367
node_dest += 1
371
368
node_orig += 1
372
369
@@ -402,9 +399,7 @@ def graph_from_incidence_matrix(matrix, node_prefix='', directed=False):
402
399
graph .add_edge (
403
400
Edge (
404
401
node_prefix + abs (nodes [0 ]),
405
- node_prefix + nodes [1 ]
406
- )
407
- )
402
+ node_prefix + nodes [1 ]))
408
403
409
404
if not directed :
410
405
graph .set_simplify (True )
@@ -521,8 +516,7 @@ def RegQueryValueEx(hkey, valuename):
521
516
# this has a return value, which we should probably check
522
517
ctypes .windll .advapi32 .RegQueryValueExA (
523
518
hkey , valuename , 0 , ctypes .byref (data_type ),
524
- data , ctypes .byref (data_len )
525
- )
519
+ data , ctypes .byref (data_len ))
526
520
527
521
return data .value
528
522
@@ -537,15 +531,13 @@ def RegQueryValueEx(hkey, valuename):
537
531
hkey = None
538
532
potentialKeys = [
539
533
"SOFTWARE\\ ATT\\ Graphviz" ,
540
- "SOFTWARE\\ AT&T Research Labs\\ Graphviz"
541
- ]
534
+ "SOFTWARE\\ AT&T Research Labs\\ Graphviz" ]
542
535
for potentialKey in potentialKeys :
543
536
544
537
try :
545
538
hkey = RegOpenKeyEx (
546
539
HKEY_LOCAL_MACHINE ,
547
- potentialKey , 0 , KEY_QUERY_VALUE
548
- )
540
+ potentialKey , 0 , KEY_QUERY_VALUE )
549
541
550
542
if hkey is not None :
551
543
path = RegQueryValueEx (hkey , "InstallPath" )
@@ -598,8 +590,7 @@ def RegQueryValueEx(hkey, valuename):
598
590
'/usr/bin' , '/usr/local/bin' ,
599
591
'/opt/local/bin' ,
600
592
'/opt/bin' , '/sw/bin' , '/usr/share' ,
601
- '/Applications/Graphviz.app/Contents/MacOS/'
602
- ):
593
+ '/Applications/Graphviz.app/Contents/MacOS/' ):
603
594
604
595
progs = __find_executables (path )
605
596
if progs is not None :
@@ -705,8 +696,8 @@ def create_attribute_methods(self, obj_attributes):
705
696
# Generate all the Setter methods.
706
697
self .__setattr__ (
707
698
'set_' + attr ,
708
- lambda x , a = attr : self .obj_dict ['attributes' ].__setitem__ ( a , x )
709
- )
699
+ lambda x , a = attr : self .obj_dict ['attributes' ].
700
+ __setitem__ ( a , x ) )
710
701
711
702
# Generate all the Getter methods.
712
703
self .__setattr__ ('get_' + attr ,
@@ -1040,8 +1031,7 @@ def __init__(
1040
1031
if graph_type not in ['graph' , 'digraph' ]:
1041
1032
raise Error ((
1042
1033
'Invalid type "%s". Accepted graph types are: '
1043
- 'graph, digraph, subgraph' % graph_type
1044
- ))
1034
+ 'graph, digraph, subgraph' % graph_type ))
1045
1035
1046
1036
self .obj_dict ['name' ] = quote_if_necessary (graph_name )
1047
1037
self .obj_dict ['type' ] = graph_type
@@ -1244,8 +1234,7 @@ def get_node(self, name):
1244
1234
match .extend ([
1245
1235
Node (obj_dict = obj_dict )
1246
1236
for obj_dict
1247
- in self .obj_dict ['nodes' ][name ]
1248
- ])
1237
+ in self .obj_dict ['nodes' ][name ]])
1249
1238
1250
1239
return match
1251
1240
@@ -1265,8 +1254,7 @@ def get_node_list(self):
1265
1254
node_objs .extend ([
1266
1255
Node (obj_dict = obj_d )
1267
1256
for obj_d
1268
- in obj_dict_list
1269
- ])
1257
+ in obj_dict_list ])
1270
1258
1271
1259
return node_objs
1272
1260
@@ -1354,8 +1342,7 @@ def get_edge(self, src_or_list, dst=None):
1354
1342
1355
1343
if edge_points in self .obj_dict ['edges' ] or (
1356
1344
self .get_top_graph_type () == 'graph' and
1357
- edge_points_reverse in self .obj_dict ['edges' ]
1358
- ):
1345
+ edge_points_reverse in self .obj_dict ['edges' ]):
1359
1346
1360
1347
edges_obj_dict = self .obj_dict ['edges' ].get (
1361
1348
edge_points ,
@@ -1383,8 +1370,7 @@ def get_edge_list(self):
1383
1370
edge_objs .extend ([
1384
1371
Edge (obj_dict = obj_d )
1385
1372
for obj_d
1386
- in obj_dict_list
1387
- ])
1373
+ in obj_dict_list ])
1388
1374
1389
1375
return edge_objs
1390
1376
@@ -1450,8 +1436,7 @@ def get_subgraph_list(self):
1450
1436
sgraph_objs .extend ([
1451
1437
Subgraph (obj_dict = obj_d )
1452
1438
for obj_d
1453
- in obj_dict_list
1454
- ])
1439
+ in obj_dict_list ])
1455
1440
1456
1441
return sgraph_objs
1457
1442
@@ -1525,8 +1510,7 @@ def to_string(self):
1525
1510
obj_list = sorted ([
1526
1511
(obj ['sequence' ], obj )
1527
1512
for obj
1528
- in (edge_obj_dicts + node_obj_dicts + sgraph_obj_dicts )
1529
- ])
1513
+ in (edge_obj_dicts + node_obj_dicts + sgraph_obj_dicts )])
1530
1514
1531
1515
for idx , obj in obj_list :
1532
1516
if obj ['type' ] == 'node' :
@@ -1663,35 +1647,31 @@ def __init__(self, *argsl, **argsd):
1663
1647
'fig' , 'gd' , 'gd2' , 'gif' , 'hpgl' , 'imap' , 'imap_np' , 'ismap' ,
1664
1648
'jpe' , 'jpeg' , 'jpg' , 'mif' , 'mp' , 'pcl' , 'pdf' , 'pic' , 'plain' ,
1665
1649
'plain-ext' , 'png' , 'ps' , 'ps2' , 'svg' , 'svgz' , 'vml' , 'vmlz' ,
1666
- 'vrml' , 'vtx' , 'wbmp' , 'xdot' , 'xlib'
1667
- ]
1650
+ 'vrml' , 'vtx' , 'wbmp' , 'xdot' , 'xlib' ]
1668
1651
self .prog = 'dot'
1669
1652
1670
1653
# Automatically creates all the methods enabling the creation
1671
1654
# of output in any of the supported formats.
1672
1655
for frmt in self .formats :
1673
1656
self .__setattr__ (
1674
1657
'create_' + frmt ,
1675
- lambda f = frmt , prog = self .prog : self . create ( format = f , prog = prog )
1676
- )
1658
+ lambda f = frmt , prog = self .prog :
1659
+ self . create ( format = f , prog = prog ) )
1677
1660
f = self .__dict__ ['create_' + frmt ]
1678
1661
f .__doc__ = (
1679
1662
'''Refer to the docstring accompanying the'''
1680
- ''''create' method for more information.'''
1681
- )
1663
+ ''''create' method for more information.''' )
1682
1664
1683
1665
for frmt in self .formats + ['raw' ]:
1684
1666
self .__setattr__ (
1685
1667
'write_' + frmt ,
1686
1668
lambda path , f = frmt , prog = self .prog : self .write (path , format = f ,
1687
- prog = prog )
1688
- )
1669
+ prog = prog ))
1689
1670
1690
1671
f = self .__dict__ ['write_' + frmt ]
1691
1672
f .__doc__ = (
1692
1673
'''Refer to the docstring accompanying the'''
1693
- ''''write' method for more information.'''
1694
- )
1674
+ ''''write' method for more information.''' )
1695
1675
1696
1676
def __getstate__ (self ):
1697
1677
return copy .copy (self .obj_dict )
0 commit comments