Skip to content

Commit

Permalink
Small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
raphv committed Aug 22, 2018
1 parent f80fffd commit 646a05f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gexf2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
PADDING = 30
MIN_EDGE_WIDTH = 1
MAX_EDGE_WIDTH = 50
DEFAULT_COLOR = {'r': 127, 'g': 127, 'b': 127}

parser = argparse.ArgumentParser()
parser.add_argument('input', type=argparse.FileType('r'), help='Input GEXF File')
Expand Down Expand Up @@ -60,7 +61,7 @@
x = float(pos.get('x'))
y = float(pos.get('y'))
size = float(node.xpath('viz:size', namespaces=nsmap)[0].get('value'))
color = node.xpath('viz:color', namespaces=nsmap)[0]
color = (node.xpath('viz:color', namespaces=nsmap) or [DEFAULT_COLOR])[0]
r = int(color.get('r'))
g = int(color.get('g'))
b = int(color.get('b'))
Expand Down

0 comments on commit 646a05f

Please sign in to comment.