original_docstring:  Returns a list of all account names.
  
      :param filter: Dictionary of attributes by which the input data should be filtered
      :param session: the database session in use.
  
      returns: a list of all account names.
      
docstring: Returns a list of all account names.
docstring_tokens: Returns a list of all account names .
code: def list_accounts(filter={}, session=None):
      """ Returns a list of all account names.
  
      :param filter: Dictionary of attributes by which the input data should be filtered
      :param session: the database session in use.
  
      returns: a list of all account names.
      """
      query = session.query(models.Account.account, models.Account.account_type,
                            models.Account.email).filter_by(status=AccountStatus.ACTIVE)
      for filter_type in filter:
          if filter_type == 'account_type':
              if isinstance(filter['account_type'], string_types):
                  query = query.filter_by(account_type=AccountType.from_sym(filter['account_type']))
              elif isinstance(filter['account_type'], EnumSymbol):
                  query = query.filter_by(account_type=filter['account_type'])
  
          elif filter_type == 'identity':
              query = query.join(models.IdentityAccountAssociation, models.Account.account == models.IdentityAccountAssociation.account).\
                  filter(models.IdentityAccountAssociation.identity == filter['identity'])
  
          elif filter_type == 'account':
              if '*' in filter['account'].internal:
                  account_str = filter['account'].internal.replace('*', '%')
                  query = query.filter(models.Account.account.like(account_str))
              else:
                  query = query.filter_by(account=filter['account'])
          else:
              query = query.join(models.AccountAttrAssociation, models.Account.account == models.AccountAttrAssociation.account).\
                  filter(models.AccountAttrAssociation.key == filter_type).\
                  filter(models.AccountAttrAssociation.value == filter[filter_type])
  
      for account, account_type, email in query.order_by(models.Account.account).yield_per(25):
          yield {'account': account, 'type': account_type, 'email': email}
code_tokens: def list_accounts ( filter = { } , session = None ) : query = session . query ( models . Account . account , models . Account . account_type , models . Account . email ) . filter_by ( status = AccountStatus . ACTIVE ) for filter_type in filter : if filter_type == 'account_type' : if isinstance ( filter [ 'account_type' ] , string_types ) : query = query . filter_by ( account_type = AccountType . from_sym ( filter [ 'account_type' ] ) ) elif isinstance ( filter [ 'account_type' ] , EnumSymbol ) : query = query . filter_by ( account_type = filter [ 'account_type' ] ) elif filter_type == 'identity' : query = query . join ( models . IdentityAccountAssociation , models . Account . account == models . IdentityAccountAssociation . account ) . filter ( models . IdentityAccountAssociation . identity == filter [ 'identity' ] ) elif filter_type == 'account' : if '*' in filter [ 'account' ] . internal : account_str = filter [ 'account' ] . internal . replace ( '*' , '%' ) query = query . filter ( models . Account . account . like ( account_str ) ) else : query = query . filter_by ( account = filter [ 'account' ] ) else : query = query . join ( models . AccountAttrAssociation , models . Account . account == models . AccountAttrAssociation . account ) . filter ( models . AccountAttrAssociation . key == filter_type ) . filter ( models . AccountAttrAssociation . value == filter [ filter_type ] ) for account , account_type , email in query . order_by ( models . Account . account ) . yield_per ( 25 ) : yield { 'account' : account , 'type' : account_type , 'email' : email }
short_docstring: Returns a list of all account names.
short_docstring_tokens: Returns a list of all account names .
comment: """ Returns a list of all account names.
  
      :param filter: Dictionary of attributes by which the input data should be filtered
      :param session: the database session in use.
  
      returns: a list of all account names.
      """