# 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
            if main_config.merge_tags:
                if main_config.replace_tags:
                    replace_left('tags', task, issue_dict, main_config.static_tags)
                else:
                    merge_left('tags', task, issue_dict)

            issue_dict.pop('annotations', None)
            issue_dict.pop('tags', None)

            task.update(issue_dict)

            if task.get_changes(keep=True):
                issue_updates['changed'].append(task)
            else:
                issue_updates['existing'].append(task)

        except MultipleMatches as e:
            log.exception("Multiple matches: %s", str(e))
        except NotFound:
            issue_updates['new'].append(issue_dict)

    notreally = ' (not really)' if dry_run else ''
    # Add new issues
    log.info("Adding %i tasks", len(issue_updates['new']))
    for issue in issue_updates['new']:
        log.info("Adding task %s%s", issue['description'], notreally)

        if dry_run:
            continue
        if notify:

# 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

            if main_config.merge_tags:
                if main_config.replace_tags:
                    replace_left('tags', task, issue_dict, main_config.static_tags)
                else:
                    merge_left('tags', task, issue_dict)

            issue_dict.pop('annotations', None)
            issue_dict.pop('tags', None)

            task.update(issue_dict)

            if task.get_changes(keep=True):
                issue_updates['changed'].append(task)
            else:
                issue_updates['existing'].append(task)

        except MultipleMatches as e:
            log.exception("Multiple matches: %s", str(e))
        except NotFound:
            issue_updates['new'].append(issue_dict)

    notreally = ' (not really)' if dry_run else ''
    # Add new issues
    log.info("Adding %i tasks", len(issue_updates['new']))
    for issue in issue_updates['new']:
        log.info("Adding task %s%s", issue['description'], notreally)

        if dry_run:
            continue
        if notify:

            send_notification(issue, 'Created', conf['notifications'])