# Path: newsreap/decorators/hook.py
# def hook(name=None, priority=Hook.priority):
#     """
#     @hook decorator allows you to map functions you've defined to be called
#     at specific times throughout the life of an action performed by newsreap.
# 
#     if you don't specify a name then the function name you wrap is used.
# 
#     The priority field allows you to set your function to be called before
#     or after others that might also be configured to run for a specific
#     type of hook.
#         @hook(name="new_name", priority=100)
#         def your_function(*args, **kwargs):
#             ...
# 
#     The lower the priority, the further to the front of the line of execution
#     it moves to. The default value is 1000
#     """
#     if callable(name):
#         def callable_hook(func):
#             # Acquire our potentially existing entries as we don't want to
#             # replace them
#             entries = getattr(func, Hook.hook_id, dict())
# 
#             # Store our new entry contents
#             entries[func.__name__] = {
#                 'priority': Hook.priority,
#             }
# 
#             # Save our entries back to the function
#             setattr(func, Hook.hook_id, entries)
# 
#             # Storing meta information into our object allows us to reference
#             # it later on by external wrappers such as the HookManager
#             setattr(func, Hook.module_id, '{module}.{function}'.format(
#                 module=splitext(basename(__file__))[0],
#                 function=func.__name__,
#             ))
# 
#             return func
#         return callable_hook(name)
# 
#     else:
#         def noncallable_hook(func):
#             # Acquire our potentially existing entries as we don't want to
#             # replace them
#             entries = getattr(func, Hook.hook_id, dict())
# 
#             # Store our new entry contents
#             entries[func.__name__ if name is None else name] = {
#                 'priority': priority,
#             }
# 
#             # Save our entries back to the function
#             setattr(func, Hook.hook_id, entries)
# 
#             # Storing meta information into our object allows us to reference
#             # it later on by external wrappers such as the HookManager
#             setattr(func, Hook.module_id, '{module}.{function}'.format(
#                 module=splitext(basename(__file__))[0],
#                 function=func.__name__,
#             ))
# 
#             return func
# 
#         return noncallable_hook
# 
# Path: newsreap/Logging.py
# NEWSREAP_CLI = '%s.cli' % NEWSREAP_LOGGER


from pprint import pformat
from newsreap.decorators import hook
from newsreap.Logging import NEWSREAP_CLI
import logging


@hook()
def post_stage(session, **kwargs):
    """
    this function gets called prior to an issued stage

    """
    logger.info(
        'DEBUG HOOK post_stage()\n{kwargs}'.format(
            kwargs=pformat(kwargs, indent=4, depth=2),
        )
    )


@hook()
def pre_upload(**kwargs):
    """
    this function gets called prior to an issued upload

    If you return False here, you will skip the upload entirely

    """
    logger.info(
        'DEBUG HOOK pre_upload()\n{kwargs}'.format(
            kwargs=pformat(kwargs, indent=4, depth=2),
        )
    )



# Path: newsreap/decorators/hook.py
# def hook(name=None, priority=Hook.priority):
#     """
#     @hook decorator allows you to map functions you've defined to be called
#     at specific times throughout the life of an action performed by newsreap.
# 
#     if you don't specify a name then the function name you wrap is used.
# 
#     The priority field allows you to set your function to be called before
#     or after others that might also be configured to run for a specific
#     type of hook.
#         @hook(name="new_name", priority=100)
#         def your_function(*args, **kwargs):
#             ...
# 
#     The lower the priority, the further to the front of the line of execution
#     it moves to. The default value is 1000
#     """
#     if callable(name):
#         def callable_hook(func):
#             # Acquire our potentially existing entries as we don't want to
#             # replace them
#             entries = getattr(func, Hook.hook_id, dict())
# 
#             # Store our new entry contents
#             entries[func.__name__] = {
#                 'priority': Hook.priority,
#             }
# 
#             # Save our entries back to the function
#             setattr(func, Hook.hook_id, entries)
# 
#             # Storing meta information into our object allows us to reference
#             # it later on by external wrappers such as the HookManager
#             setattr(func, Hook.module_id, '{module}.{function}'.format(
#                 module=splitext(basename(__file__))[0],
#                 function=func.__name__,
#             ))
# 
#             return func
#         return callable_hook(name)
# 
#     else:
#         def noncallable_hook(func):
#             # Acquire our potentially existing entries as we don't want to
#             # replace them
#             entries = getattr(func, Hook.hook_id, dict())
# 
#             # Store our new entry contents
#             entries[func.__name__ if name is None else name] = {
#                 'priority': priority,
#             }
# 
#             # Save our entries back to the function
#             setattr(func, Hook.hook_id, entries)
# 
#             # Storing meta information into our object allows us to reference
#             # it later on by external wrappers such as the HookManager
#             setattr(func, Hook.module_id, '{module}.{function}'.format(
#                 module=splitext(basename(__file__))[0],
#                 function=func.__name__,
#             ))
# 
#             return func
# 
#         return noncallable_hook
# 
# Path: newsreap/Logging.py
# NEWSREAP_CLI = '%s.cli' % NEWSREAP_LOGGER


# Path: newsreap/hooks/post/debug.py
from pprint import pformat
from newsreap.decorators import hook
from newsreap.Logging import NEWSREAP_CLI
import logging



@hook()
def post_stage(session, **kwargs):
    """
    this function gets called prior to an issued stage

    """
    logger.info(
        'DEBUG HOOK post_stage()\n{kwargs}'.format(
            kwargs=pformat(kwargs, indent=4, depth=2),
        )
    )


@hook()
def pre_upload(**kwargs):
    """
    this function gets called prior to an issued upload

    If you return False here, you will skip the upload entirely

    """
    logger.info(
        'DEBUG HOOK pre_upload()\n{kwargs}'.format(
            kwargs=pformat(kwargs, indent=4, depth=2),
        )
    )



@hook()