CMS 3D CMS Logo

Classes | Functions
FrontierCondition_GT_autoExpress_cfi Namespace Reference

Classes

class  Tier0Error
 
class  Tier0Handler
 

Functions

def unique (seq, keepstr=True)
 

Function Documentation

def FrontierCondition_GT_autoExpress_cfi.unique (   seq,
  keepstr = True 
)

Definition at line 33 of file FrontierCondition_GT_autoExpress_cfi.py.

References GetRecoTauVFromDQM_MC_cff.next, and lumiQTWidget.t.

Referenced by FrontierCondition_GT_autoExpress_cfi.Tier0Handler.getGlobalTag().

33 def unique(seq, keepstr=True):
34  t = type(seq)
35  if t in (unicode, str):
36  t = (list, t('').join)[bool(keepstr)]
37  try:
38  remaining = set(seq)
39  seen = set()
40  return t(c for c in seq if (c in remaining and not remaining.remove(c)))
41  except TypeError: # hashing didn't work, see if seq is sortable
42  try:
43  from itertools import groupby
44  s = sorted(enumerate(seq),key=lambda i_v1:(i_v1[1],i_v1[0]))
45  return t(next(g) for k,g in groupby(s, lambda i_v: i_v[1]))
46  except: # not sortable, use brute force
47  seen = []
48  return t(c for c in seq if not (c in seen or seen.append(c)))
49