Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_snapshots(lines, comments='#', directed=False, delimiter=None, nodetype=None, timestamptype=None, keys=None):
if not directed:
G = DynGraph()
else:
G = DynDiGraph()
for line in lines:
p = line.find(comments)
if p >= 0:
line = line[:p]
if not len(line):
continue
# split line, should have 2 or more
s = line.strip().split(delimiter)
if len(s) < 3:
continue
if len(s) == 3:
u = s.pop(0)
v = s.pop(0)
t = s.pop(0)
e = None
def parse_interactions(lines, comments='#', directed=False, delimiter=None, nodetype=None, timestamptype=None,
keys=None):
if not directed:
G = DynGraph()
else:
G = DynDiGraph()
for line in lines:
p = line.find(comments)
if p >= 0:
line = line[:p]
if not len(line):
continue
s = line.strip().split(delimiter)
if len(s) != 4:
continue
else:
u = s.pop(0)
v = s.pop(0)