def _EnumerateNotificationsFromArgs(self, accept_notification_configs=True):
    'Yields bucket/notification tuples from command-line args.\n\n    Given a list of strings that are bucket names (gs://foo) or notification\n    config IDs, yield tuples of bucket names and their associated notifications.\n\n    Args:\n      accept_notification_configs: whether notification configs are valid args.\n    Yields:\n      Tuples of the form (bucket_name, Notification)\n    '
    path_regex = self._GetNotificationPathRegex()
    for list_entry in self.args:
        match = path_regex.match(list_entry)
        if match:
            if (not accept_notification_configs):
                raise CommandException(('%s %s accepts only bucket names, but you provided %s' % (self.command_name, self.subcommand_name, list_entry)))
            bucket_name = match.group('bucket')
            notification_id = match.group('notification')
            found = False
            for notification in self.gsutil_api.ListNotificationConfigs(bucket_name, provider='gs'):
                if (notification.id == notification_id):
                    (yield (bucket_name, notification))
                    found = True
                    break
            if (not found):
                raise NotFoundException(('Could not find notification %s' % list_entry))
        else:
            storage_url = StorageUrlFromString(list_entry)
            if (not storage_url.IsCloudUrl()):
                raise CommandException(('The %s command must be used on cloud buckets or notification config names.' % self.command_name))
            if (storage_url.scheme != 'gs'):
                raise CommandException('The %s command only works on gs:// buckets.')
            path = None
            if storage_url.IsProvider():
                path = 'gs://*'
            elif storage_url.IsBucket():
                path = list_entry
            if (not path):
                raise CommandException(('The %s command cannot be used on cloud objects, only buckets' % self.command_name))
            for blr in self.WildcardIterator(path).IterBuckets(bucket_fields=['id']):
                for notification in self.gsutil_api.ListNotificationConfigs(blr.storage_url.bucket_name, provider='gs'):
                    (yield (blr.storage_url.bucket_name, notification))
Yields bucket/notification tuples from command-line args.

Given a list of strings that are bucket names (gs://foo) or notification
config IDs, yield tuples of bucket names and their associated notifications.

Args:
  accept_notification_configs: whether notification configs are valid args.
Yields:
  Tuples of the form (bucket_name, Notification)
def _EnumerateNotificationsFromArgs(self, accept_notification_configs=True):
    'Yields bucket/notification tuples from command-line args.\n\n    Given a list of strings that are bucket names (gs://foo) or notification\n    config IDs, yield tuples of bucket names and their associated notifications.\n\n    Args:\n      accept_notification_configs: whether notification configs are valid args.\n    Yields:\n      Tuples of the form (bucket_name, Notification)\n    '
    path_regex = self._GetNotificationPathRegex()
    for list_entry in self.args:
        match = path_regex.match(list_entry)
        if match:
            if (not accept_notification_configs):
                raise CommandException(('%s %s accepts only bucket names, but you provided %s' % (self.command_name, self.subcommand_name, list_entry)))
            bucket_name = match.group('bucket')
            notification_id = match.group('notification')
            found = False
            for notification in self.gsutil_api.ListNotificationConfigs(bucket_name, provider='gs'):
                if (notification.id == notification_id):
                    (yield (bucket_name, notification))
                    found = True
                    break
            if (not found):
                raise NotFoundException(('Could not find notification %s' % list_entry))
        else:
            storage_url = StorageUrlFromString(list_entry)
            if (not storage_url.IsCloudUrl()):
                raise CommandException(('The %s command must be used on cloud buckets or notification config names.' % self.command_name))
            if (storage_url.scheme != 'gs'):
                raise CommandException('The %s command only works on gs:// buckets.')
            path = None
            if storage_url.IsProvider():
                path = 'gs://*'
            elif storage_url.IsBucket():
                path = list_entry
            if (not path):
                raise CommandException(('The %s command cannot be used on cloud objects, only buckets' % self.command_name))
            for blr in self.WildcardIterator(path).IterBuckets(bucket_fields=['id']):
                for notification in self.gsutil_api.ListNotificationConfigs(blr.storage_url.bucket_name, provider='gs'):
                    (yield (blr.storage_url.bucket_name, notification))