# Path: heatclient/_i18n.py
# def get_available_languages():
# def enable_lazy():
# 
# Path: heatclient/common/utils.py
# LOG = logging.getLogger(__name__)
# def arg(*args, **kwargs):
#     def _decorator(func):
# def env(*args, **kwargs):
# def add_arg(func, *args, **kwargs):
# def print_list(objs, fields, formatters=None, sortby_index=0,
#                mixed_case_fields=None, field_labels=None):
# def link_formatter(links):
#     def format_link(l):
# def resource_nested_identifier(rsrc):
# def json_formatter(js):
# def yaml_formatter(js):
# def text_wrap_formatter(d):
# def newline_list_formatter(r):
# def print_dict(d, formatters=None):
#     def __init__(self):
#     def prepend_paths(self, resource_path, stack_id):
#     def build_resource_name(self, event):
#         def get_stack_id():
# def event_log_formatter(events, event_log_context=None):
# def print_update_list(lst, fields, formatters=None):
# def find_resource(manager, name_or_id):
# def format_parameters(params, parse_semicolon=True):
# def format_all_parameters(params, param_files,
#                           template_file=None, template_url=None):
# def format_parameter_file(param_files, template_file=None,
#                           template_url=None):
# def resolve_param_get_file(file, base_url):
# def format_output(output, format='yaml'):
# def parse_query_url(url):
# def get_template_url(template_file=None, template_url=None):
# def read_url_content(url):
# def base_url_for_url(url):
# def normalise_file_path_to_url(path):
# def get_response_body(resp):
# class EventLogContext(object):
# 
# Path: heatclient/v1/events.py
# DEFAULT_PAGE_SIZE = 20
# class Event(base.Resource):
# class EventManager(stacks.StackChildManager):
#     def __repr__(self):
#     def update(self, **fields):
#     def delete(self):
#     def data(self, **kwargs):
#     def list(self, stack_id, resource_name=None, **kwargs):
#     def get(self, stack_id, resource_name, event_id):


import sys
import time
import heatclient.exc as exc
from heatclient._i18n import _
from heatclient.common import utils
from heatclient.v1 import events as events_mod
        raise exc.CommandError(_('Unexpected hook type %s') % hook_type)

    events = get_events(hc, stack_id=stack_id, event_args=event_args,
                        nested_depth=nested_depth)

    # Get the most recent event associated with this action, which gives us the
    # event when we moved into IN_PROGRESS for the hooks we're interested in.
    stack_name = stack_id.split("/")[0]
    action_start_event = [e for e in enumerate(events)
                          if e[1].resource_status_reason == stack_action_reason
                          and e[1].stack_name == stack_name][-1]
    # Slice the events with the index from the enumerate
    action_start_index = action_start_event[0]
    events = events[action_start_index:]

    # Get hook events still pending by some list filtering/comparison
    # We build a map hook events per-resource, and remove any event
    # for which there is a corresponding hook-clear event.
    resource_event_map = {}
    for e in events:
        stack_resource = (e.stack_name, e.resource_name)
        if e.resource_status_reason == hook_event_reason:
            resource_event_map[(e.stack_name, e.resource_name)] = e
        elif e.resource_status_reason == hook_clear_event_reason:
            if resource_event_map.get(stack_resource):
                del(resource_event_map[(e.stack_name, e.resource_name)])
    return list(resource_event_map.values())


def get_events(hc, stack_id, event_args, nested_depth=0,

# Path: heatclient/_i18n.py
# def get_available_languages():
# def enable_lazy():
# 
# Path: heatclient/common/utils.py
# LOG = logging.getLogger(__name__)
# def arg(*args, **kwargs):
#     def _decorator(func):
# def env(*args, **kwargs):
# def add_arg(func, *args, **kwargs):
# def print_list(objs, fields, formatters=None, sortby_index=0,
#                mixed_case_fields=None, field_labels=None):
# def link_formatter(links):
#     def format_link(l):
# def resource_nested_identifier(rsrc):
# def json_formatter(js):
# def yaml_formatter(js):
# def text_wrap_formatter(d):
# def newline_list_formatter(r):
# def print_dict(d, formatters=None):
#     def __init__(self):
#     def prepend_paths(self, resource_path, stack_id):
#     def build_resource_name(self, event):
#         def get_stack_id():
# def event_log_formatter(events, event_log_context=None):
# def print_update_list(lst, fields, formatters=None):
# def find_resource(manager, name_or_id):
# def format_parameters(params, parse_semicolon=True):
# def format_all_parameters(params, param_files,
#                           template_file=None, template_url=None):
# def format_parameter_file(param_files, template_file=None,
#                           template_url=None):
# def resolve_param_get_file(file, base_url):
# def format_output(output, format='yaml'):
# def parse_query_url(url):
# def get_template_url(template_file=None, template_url=None):
# def read_url_content(url):
# def base_url_for_url(url):
# def normalise_file_path_to_url(path):
# def get_response_body(resp):
# class EventLogContext(object):
# 
# Path: heatclient/v1/events.py
# DEFAULT_PAGE_SIZE = 20
# class Event(base.Resource):
# class EventManager(stacks.StackChildManager):
#     def __repr__(self):
#     def update(self, **fields):
#     def delete(self):
#     def data(self, **kwargs):
#     def list(self, stack_id, resource_name=None, **kwargs):
#     def get(self, stack_id, resource_name, event_id):


# Path: heatclient/common/event_utils.py
import sys
import time
import heatclient.exc as exc
from heatclient._i18n import _
from heatclient.common import utils
from heatclient.v1 import events as events_mod

        raise exc.CommandError(_('Unexpected hook type %s') % hook_type)

    events = get_events(hc, stack_id=stack_id, event_args=event_args,
                        nested_depth=nested_depth)

    # Get the most recent event associated with this action, which gives us the
    # event when we moved into IN_PROGRESS for the hooks we're interested in.
    stack_name = stack_id.split("/")[0]
    action_start_event = [e for e in enumerate(events)
                          if e[1].resource_status_reason == stack_action_reason
                          and e[1].stack_name == stack_name][-1]
    # Slice the events with the index from the enumerate
    action_start_index = action_start_event[0]
    events = events[action_start_index:]

    # Get hook events still pending by some list filtering/comparison
    # We build a map hook events per-resource, and remove any event
    # for which there is a corresponding hook-clear event.
    resource_event_map = {}
    for e in events:
        stack_resource = (e.stack_name, e.resource_name)
        if e.resource_status_reason == hook_event_reason:
            resource_event_map[(e.stack_name, e.resource_name)] = e
        elif e.resource_status_reason == hook_clear_event_reason:
            if resource_event_map.get(stack_resource):
                del(resource_event_map[(e.stack_name, e.resource_name)])
    return list(resource_event_map.values())


def get_events(hc, stack_id, event_args, nested_depth=0,

               marker=None, limit=None):