def list_subscription_rule_states(name=None, account=None): """Returns a list of with the number of rules per state for a subscription. :param name: Name of the subscription :param account: Account identifier :param session: The database session in use. :returns: List with tuple (account, name, state, count) """ return subscription.list_subscription_rule_states(name, account)
def list_subscription_rule_states(name=None, account=None): """Returns a list of with the number of rules per state for a subscription. :param name: Name of the subscription :param account: Account identifier :param session: The database session in use. :returns: List with tuple (account, name, state, count) """ return subscription.list_subscription_rule_states(name, account)
def list_subscription_rule_states(name=None, account=None): """Returns a list of with the number of rules per state for a subscription. :param name: Name of the subscription :param account: Account identifier :param session: The database session in use. :returns: List with tuple (account, name, state, count) """ if account is not None: account = InternalAccount(account) subs = subscription.list_subscription_rule_states(name, account) for sub in subs: # sub is an immutable KeyedTuple so return new KeyedTuple with edited entries labels = sub._fields d = sub._asdict() d['account'] = d['account'].external yield KeyedTuple([d[l] for l in labels], labels=labels)
def list_subscription_rule_states(name=None, account=None, vo='def'): """Returns a list of with the number of rules per state for a subscription. :param name: Name of the subscription :param account: Account identifier :param vo: The VO to act on. :returns: Sequence with SubscriptionRuleState named tuples (account, name, state, count) """ if account is not None: account = InternalAccount(account, vo=vo) else: account = InternalAccount('*', vo=vo) subs = subscription.list_subscription_rule_states(name, account) for sub in subs: # sub is an immutable Row so return new named tuple with edited entries d = sub._asdict() d['account'] = d['account'].external yield SubscriptionRuleState(**d)