def identity_key(*args, **kwargs):
 if args:
  if (len(args) == 1):
   class_ = args[0]
   try:
    row = kwargs.pop('row')
   except KeyError:
    ident = kwargs.pop('ident')
  elif (len(args) == 2):
   (class_, ident) = args
  elif (len(args) == 3):
   (class_, ident) = args
  else:
   raise sa_exc.ArgumentError(('expected up to three positional arguments, got %s' % len(args)))
  if kwargs:
   raise sa_exc.ArgumentError(('unknown keyword arguments: %s' % ', '.join(kwargs)))
  mapper = class_mapper(class_)
  if ('ident' in locals()):
   return mapper.identity_key_from_primary_key(util.to_list(ident))
  return mapper.identity_key_from_row(row)
 instance = kwargs.pop('instance')
 if kwargs:
  raise sa_exc.ArgumentError(('unknown keyword arguments: %s' % ', '.join(kwargs.keys)))
 mapper = object_mapper(instance)
 return mapper.identity_key_from_instance(instance)

def identity_key ( * args , ** kwargs ) : if args : if ( len ( args ) == 1 ) : class_ = args [ 0 ] try : row = kwargs . pop ( 'row' ) except KeyError : ident = kwargs . pop ( 'ident' ) elif ( len ( args ) == 2 ) : ( class_ , ident ) = args elif ( len ( args ) == 3 ) : ( class_ , ident ) = args else : raise sa_exc . ArgumentError ( ( 'expected up to three positional arguments, got %s' % len ( args ) ) ) if kwargs : raise sa_exc . ArgumentError ( ( 'unknown keyword arguments: %s' % ', ' . join ( kwargs ) ) ) mapper = class_mapper ( class_ ) if ( 'ident' in locals ( ) ) : return mapper . identity_key_from_primary_key ( util . to_list ( ident ) ) return mapper . identity_key_from_row ( row ) instance = kwargs . pop ( 'instance' ) if kwargs : raise sa_exc . ArgumentError ( ( 'unknown keyword arguments: %s' % ', ' . join ( kwargs . keys ) ) ) mapper = object_mapper ( instance ) return mapper . identity_key_from_instance ( instance )
generate "identity key" tuples .