# Path: bugwarrior/notifications.py
# def send_notification(issue, op, conf):
#     notify_backend = conf.backend
# 
#     if notify_backend == 'pynotify':
#         warnings.warn("pynotify is deprecated.  Use backend=gobject.  "
#                       "See https://github.com/ralphbean/bugwarrior/issues/336")
#         notify_backend = 'gobject'
# 
#     # Notifications for growlnotify on Mac OS X
#     if notify_backend == 'growlnotify':
#         import gntp.notifier
#         growl = gntp.notifier.GrowlNotifier(
#             applicationName="Bugwarrior",
#             notifications=["New Updates", "New Messages"],
#             defaultNotifications=["New Messages"],
#         )
#         growl.register()
#         if op == 'bw_finished':
#             growl.notify(
#                 noteType="New Messages",
#                 title="Bugwarrior",
#                 description="Finished querying for new issues.\n%s" %
#                 issue['description'],
#                 sticky=conf.finished_querying_sticky,
#                 icon="https://upload.wikimedia.org/wikipedia/"
#                 "en/5/59/Taskwarrior_logo.png",
#                 priority=1,
#             )
#             return
#         message = "%s task: %s" % (op, issue['description'])
#         metadata = _get_metadata(issue)
#         if metadata is not None:
#             message += metadata
#         growl.notify(
#             noteType="New Messages",
#             title="Bugwarrior",
#             description=message,
#             sticky=conf.task_crud_sticky,
#             icon="https://upload.wikimedia.org/wikipedia/"
#             "en/5/59/Taskwarrior_logo.png",
#             priority=1,
#         )
#         return
#     elif notify_backend == 'gobject':
#         _cache_logo()
# 
#         import gi
#         gi.require_version('Notify', '0.7')
#         from gi.repository import Notify
#         Notify.init("bugwarrior")
# 
#         if op == 'bw finished':
#             message = "Finished querying for new issues.\n%s" %\
#                 issue['description']
#         else:
#             message = "%s task: %s" % (op, issue['description'])
#             metadata = _get_metadata(issue)
#             if metadata is not None:
#                 message += metadata
# 
#         Notify.Notification.new("Bugwarrior", message, logo_path).show()


import json
import os
import re
import subprocess
import requests
import dogpile.cache
import logging
from taskw import TaskWarriorShellout
from taskw.exceptions import TaskwarriorError
from bugwarrior.notifications import send_notification
    from bugwarrior.services import get_service
    from bugwarrior.services import get_service
        tw,
        build_key_list(
            set([conf[target].service for target in targets])))
    issue_updates['closed'] = succeeded_service_task_uuids - seen_uuids
    log.info("Closing %i tasks", len(issue_updates['closed']))
    for issue in issue_updates['closed']:
        _, task_info = tw.get_task(uuid=issue)
        log.info(
            "Completing task %s %s%s",
            issue,
            task_info.get('description', ''),
            notreally
        )
        if dry_run:
            continue

        if notify:
            send_notification(task_info, 'Completed', conf['notifications'])

        try:
            tw.task_done(uuid=issue)
        except TaskwarriorError as e:
            log.exception("Unable to close task: %s" % e.stderr)

    # Send notifications
    if notify:
        updates = (len(issue_updates['new']) +
                   len(issue_updates['changed']) +
                   len(issue_updates['closed']))
        if not conf['notifications'].only_on_new_tasks or updates > 0:

# Path: bugwarrior/notifications.py
# def send_notification(issue, op, conf):
#     notify_backend = conf.backend
# 
#     if notify_backend == 'pynotify':
#         warnings.warn("pynotify is deprecated.  Use backend=gobject.  "
#                       "See https://github.com/ralphbean/bugwarrior/issues/336")
#         notify_backend = 'gobject'
# 
#     # Notifications for growlnotify on Mac OS X
#     if notify_backend == 'growlnotify':
#         import gntp.notifier
#         growl = gntp.notifier.GrowlNotifier(
#             applicationName="Bugwarrior",
#             notifications=["New Updates", "New Messages"],
#             defaultNotifications=["New Messages"],
#         )
#         growl.register()
#         if op == 'bw_finished':
#             growl.notify(
#                 noteType="New Messages",
#                 title="Bugwarrior",
#                 description="Finished querying for new issues.\n%s" %
#                 issue['description'],
#                 sticky=conf.finished_querying_sticky,
#                 icon="https://upload.wikimedia.org/wikipedia/"
#                 "en/5/59/Taskwarrior_logo.png",
#                 priority=1,
#             )
#             return
#         message = "%s task: %s" % (op, issue['description'])
#         metadata = _get_metadata(issue)
#         if metadata is not None:
#             message += metadata
#         growl.notify(
#             noteType="New Messages",
#             title="Bugwarrior",
#             description=message,
#             sticky=conf.task_crud_sticky,
#             icon="https://upload.wikimedia.org/wikipedia/"
#             "en/5/59/Taskwarrior_logo.png",
#             priority=1,
#         )
#         return
#     elif notify_backend == 'gobject':
#         _cache_logo()
# 
#         import gi
#         gi.require_version('Notify', '0.7')
#         from gi.repository import Notify
#         Notify.init("bugwarrior")
# 
#         if op == 'bw finished':
#             message = "Finished querying for new issues.\n%s" %\
#                 issue['description']
#         else:
#             message = "%s task: %s" % (op, issue['description'])
#             metadata = _get_metadata(issue)
#             if metadata is not None:
#                 message += metadata
# 
#         Notify.Notification.new("Bugwarrior", message, logo_path).show()


# Path: bugwarrior/db.py
import json
import os
import re
import subprocess
import requests
import dogpile.cache
import logging
from taskw import TaskWarriorShellout
from taskw.exceptions import TaskwarriorError
from bugwarrior.notifications import send_notification
    from bugwarrior.services import get_service
    from bugwarrior.services import get_service

        tw,
        build_key_list(
            set([conf[target].service for target in targets])))
    issue_updates['closed'] = succeeded_service_task_uuids - seen_uuids
    log.info("Closing %i tasks", len(issue_updates['closed']))
    for issue in issue_updates['closed']:
        _, task_info = tw.get_task(uuid=issue)
        log.info(
            "Completing task %s %s%s",
            issue,
            task_info.get('description', ''),
            notreally
        )
        if dry_run:
            continue

        if notify:
            send_notification(task_info, 'Completed', conf['notifications'])

        try:
            tw.task_done(uuid=issue)
        except TaskwarriorError as e:
            log.exception("Unable to close task: %s" % e.stderr)

    # Send notifications
    if notify:
        updates = (len(issue_updates['new']) +
                   len(issue_updates['changed']) +
                   len(issue_updates['closed']))
        if not conf['notifications'].only_on_new_tasks or updates > 0:

            send_notification(