fixed shebangs in non executable .py files
[nepi.git] / src / nepi / util / guid.py
1 # -*- coding: utf-8 -*-
2
3 class GuidGenerator(object):
4     def __init__(self):
5         self._guids = list()
6
7     def next(self, guid = None):
8         if guid != None:
9             if guid in self._guids:
10                 raise RuntimeError("guid %d is already assigned" % guid)
11         else:
12             last_guid = 0 if len(self._guids) == 0 else self._guids[-1]
13             guid = last_guid + 1 
14         self._guids.append(guid)
15         self._guids.sort()
16         return guid
17