Package Ganga :: Package Utility :: Module guid
[hide private]
[frames] | no frames]

Source Code for Module Ganga.Utility.guid

 1  """module to build GUIDs""" 
 2   
 3   
 4  import time 
 5  import random 
 6   
 7  # provide uuid missing in python < 2.5 
 8   
 9  try: # 2.5 
10      import uuid as uuid_module 
11 - def uuid():
12 return str(uuid_module.uuid4())
13 except ImportError: # <2.5 14 # FIXME: poor's man uuid
15 - def uuid():
16 """Poor's man uuid. This is a stub provided by Ganga to 17 complement missing functionality in python<2.5""" 18 return (str(random.uniform(0,100000000))+'-'+str(time.time())).replace('.','-')
19 20 21 22 23 #--------------------------------------------------------------------------- 24 # this function will become obsolete when ARDA job repository is phased out
25 -def newGuid(value = None):
26 """newGUID(value = None) --> guid 27 value - any python object""" 28 tt = time.gmtime()[0:6] + (random.randint(0,9), 29 random.randint(0,9), 30 random.randint(0,9), 31 id(value)) 32 return '_' + (''.join(map(str, tt))).replace('-','')
33