# Path: src/bin/syndication_app/feedparser/util.py
# class FeedParserDict(dict):
#     keymap = {
#         'channel': 'feed',
#         'items': 'entries',
#         'guid': 'id',
#         'date': 'updated',
#         'date_parsed': 'updated_parsed',
#         'description': ['summary', 'subtitle'],
#         'description_detail': ['summary_detail', 'subtitle_detail'],
#         'url': ['href'],
#         'modified': 'updated',
#         'modified_parsed': 'updated_parsed',
#         'issued': 'published',
#         'issued_parsed': 'published_parsed',
#         'copyright': 'rights',
#         'copyright_detail': 'rights_detail',
#         'tagline': 'subtitle',
#         'tagline_detail': 'subtitle_detail',
#     }
# 
#     def __getitem__(self, key):
#         """
#         :return: A :class:`FeedParserDict`.
#         """
# 
#         if key == 'category':
#             try:
#                 return dict.__getitem__(self, 'tags')[0]['term']
#             except IndexError:
#                 raise KeyError("object doesn't have key 'category'")
#         elif key == 'enclosures':
#             norel = lambda link: FeedParserDict([(name, value) for (name, value) in link.items() if name != 'rel'])
#             return [
#                 norel(link)
#                 for link in dict.__getitem__(self, 'links')
#                 if link['rel'] == 'enclosure'
#             ]
#         elif key == 'license':
#             for link in dict.__getitem__(self, 'links'):
#                 if link['rel'] == 'license' and 'href' in link:
#                     return link['href']
#         elif key == 'updated':
#             # Temporarily help developers out by keeping the old
#             # broken behavior that was reported in issue 310.
#             # This fix was proposed in issue 328.
#             if (
#                     not dict.__contains__(self, 'updated')
#                     and dict.__contains__(self, 'published')
#             ):
#                 warnings.warn(
#                     "To avoid breaking existing software while "
#                     "fixing issue 310, a temporary mapping has been created "
#                     "from `updated` to `published` if `updated` doesn't "
#                     "exist. This fallback will be removed in a future version "
#                     "of feedparser.",
#                     DeprecationWarning,
#                 )
#                 return dict.__getitem__(self, 'published')
#             return dict.__getitem__(self, 'updated')
#         elif key == 'updated_parsed':
#             if (
#                     not dict.__contains__(self, 'updated_parsed')
#                     and dict.__contains__(self, 'published_parsed')
#             ):
#                 warnings.warn(
#                     "To avoid breaking existing software while "
#                     "fixing issue 310, a temporary mapping has been created "
#                     "from `updated_parsed` to `published_parsed` if "
#                     "`updated_parsed` doesn't exist. This fallback will be "
#                     "removed in a future version of feedparser.",
#                     DeprecationWarning,
#                 )
#                 return dict.__getitem__(self, 'published_parsed')
#             return dict.__getitem__(self, 'updated_parsed')
#         else:
#             realkey = self.keymap.get(key, key)
#             if isinstance(realkey, list):
#                 for k in realkey:
#                     if dict.__contains__(self, k):
#                         return dict.__getitem__(self, k)
#             elif dict.__contains__(self, realkey):
#                 return dict.__getitem__(self, realkey)
#         return dict.__getitem__(self, key)
# 
#     def __contains__(self, key):
#         if key in ('updated', 'updated_parsed'):
#             # Temporarily help developers out by keeping the old
#             # broken behavior that was reported in issue 310.
#             # This fix was proposed in issue 328.
#             return dict.__contains__(self, key)
#         try:
#             self.__getitem__(key)
#         except KeyError:
#             return False
#         else:
#             return True
# 
#     has_key = __contains__
# 
#     def get(self, key, default=None):
#         """
#         :return: A :class:`FeedParserDict`.
#         """
# 
#         try:
#             return self.__getitem__(key)
#         except KeyError:
#             return default
# 
#     def __setitem__(self, key, value):
#         key = self.keymap.get(key, key)
#         if isinstance(key, list):
#             key = key[0]
#         return dict.__setitem__(self, key, value)
# 
#     def setdefault(self, k, default):
#         if k not in self:
#             self[k] = default
#             return default
#         return self[k]
# 
#     def __getattr__(self, key):
#         # __getattribute__() is called first; this will be called
#         # only if an attribute was not already found
#         try:
#             return self.__getitem__(key)
#         except KeyError:
#             raise AttributeError("object has no attribute '%s'" % key)
# 
#     def __hash__(self):
#         # This is incorrect behavior -- dictionaries shouldn't be hashable.
#         # Note to self: remove this behavior in the future.
#         return id(self)


from ..util import FeedParserDict

    def _start_itunes_summary(self, attrs_d):
        self._start_summary(attrs_d)

    def _end_itunes_summary(self):
        self._end_summary()

    def _start_itunes_owner(self, attrs_d):
        self.inpublisher = 1
        self.push('publisher', 0)

    def _end_itunes_owner(self):
        self.pop('publisher')
        self.inpublisher = 0
        self._sync_author_detail('publisher')

    def _end_itunes_keywords(self):
        for term in self.pop('itunes_keywords').split(','):
            if term.strip():
                self._add_tag(term.strip(), 'http://www.itunes.com/', None)

    def _start_itunes_category(self, attrs_d):
        self._add_tag(attrs_d.get('text'), 'http://www.itunes.com/', None)
        self.push('category', 1)

    def _start_itunes_image(self, attrs_d):
        self.push('itunes_image', 0)
        if attrs_d.get('href'):
            self._get_context()['image'] = FeedParserDict({'href': attrs_d.get('href')})
        elif attrs_d.get('url'):

# Path: src/bin/syndication_app/feedparser/util.py
# class FeedParserDict(dict):
#     keymap = {
#         'channel': 'feed',
#         'items': 'entries',
#         'guid': 'id',
#         'date': 'updated',
#         'date_parsed': 'updated_parsed',
#         'description': ['summary', 'subtitle'],
#         'description_detail': ['summary_detail', 'subtitle_detail'],
#         'url': ['href'],
#         'modified': 'updated',
#         'modified_parsed': 'updated_parsed',
#         'issued': 'published',
#         'issued_parsed': 'published_parsed',
#         'copyright': 'rights',
#         'copyright_detail': 'rights_detail',
#         'tagline': 'subtitle',
#         'tagline_detail': 'subtitle_detail',
#     }
# 
#     def __getitem__(self, key):
#         """
#         :return: A :class:`FeedParserDict`.
#         """
# 
#         if key == 'category':
#             try:
#                 return dict.__getitem__(self, 'tags')[0]['term']
#             except IndexError:
#                 raise KeyError("object doesn't have key 'category'")
#         elif key == 'enclosures':
#             norel = lambda link: FeedParserDict([(name, value) for (name, value) in link.items() if name != 'rel'])
#             return [
#                 norel(link)
#                 for link in dict.__getitem__(self, 'links')
#                 if link['rel'] == 'enclosure'
#             ]
#         elif key == 'license':
#             for link in dict.__getitem__(self, 'links'):
#                 if link['rel'] == 'license' and 'href' in link:
#                     return link['href']
#         elif key == 'updated':
#             # Temporarily help developers out by keeping the old
#             # broken behavior that was reported in issue 310.
#             # This fix was proposed in issue 328.
#             if (
#                     not dict.__contains__(self, 'updated')
#                     and dict.__contains__(self, 'published')
#             ):
#                 warnings.warn(
#                     "To avoid breaking existing software while "
#                     "fixing issue 310, a temporary mapping has been created "
#                     "from `updated` to `published` if `updated` doesn't "
#                     "exist. This fallback will be removed in a future version "
#                     "of feedparser.",
#                     DeprecationWarning,
#                 )
#                 return dict.__getitem__(self, 'published')
#             return dict.__getitem__(self, 'updated')
#         elif key == 'updated_parsed':
#             if (
#                     not dict.__contains__(self, 'updated_parsed')
#                     and dict.__contains__(self, 'published_parsed')
#             ):
#                 warnings.warn(
#                     "To avoid breaking existing software while "
#                     "fixing issue 310, a temporary mapping has been created "
#                     "from `updated_parsed` to `published_parsed` if "
#                     "`updated_parsed` doesn't exist. This fallback will be "
#                     "removed in a future version of feedparser.",
#                     DeprecationWarning,
#                 )
#                 return dict.__getitem__(self, 'published_parsed')
#             return dict.__getitem__(self, 'updated_parsed')
#         else:
#             realkey = self.keymap.get(key, key)
#             if isinstance(realkey, list):
#                 for k in realkey:
#                     if dict.__contains__(self, k):
#                         return dict.__getitem__(self, k)
#             elif dict.__contains__(self, realkey):
#                 return dict.__getitem__(self, realkey)
#         return dict.__getitem__(self, key)
# 
#     def __contains__(self, key):
#         if key in ('updated', 'updated_parsed'):
#             # Temporarily help developers out by keeping the old
#             # broken behavior that was reported in issue 310.
#             # This fix was proposed in issue 328.
#             return dict.__contains__(self, key)
#         try:
#             self.__getitem__(key)
#         except KeyError:
#             return False
#         else:
#             return True
# 
#     has_key = __contains__
# 
#     def get(self, key, default=None):
#         """
#         :return: A :class:`FeedParserDict`.
#         """
# 
#         try:
#             return self.__getitem__(key)
#         except KeyError:
#             return default
# 
#     def __setitem__(self, key, value):
#         key = self.keymap.get(key, key)
#         if isinstance(key, list):
#             key = key[0]
#         return dict.__setitem__(self, key, value)
# 
#     def setdefault(self, k, default):
#         if k not in self:
#             self[k] = default
#             return default
#         return self[k]
# 
#     def __getattr__(self, key):
#         # __getattribute__() is called first; this will be called
#         # only if an attribute was not already found
#         try:
#             return self.__getitem__(key)
#         except KeyError:
#             raise AttributeError("object has no attribute '%s'" % key)
# 
#     def __hash__(self):
#         # This is incorrect behavior -- dictionaries shouldn't be hashable.
#         # Note to self: remove this behavior in the future.
#         return id(self)


# Path: src/bin/syndication_app/feedparser/namespaces/itunes.py
from ..util import FeedParserDict


    def _start_itunes_summary(self, attrs_d):
        self._start_summary(attrs_d)

    def _end_itunes_summary(self):
        self._end_summary()

    def _start_itunes_owner(self, attrs_d):
        self.inpublisher = 1
        self.push('publisher', 0)

    def _end_itunes_owner(self):
        self.pop('publisher')
        self.inpublisher = 0
        self._sync_author_detail('publisher')

    def _end_itunes_keywords(self):
        for term in self.pop('itunes_keywords').split(','):
            if term.strip():
                self._add_tag(term.strip(), 'http://www.itunes.com/', None)

    def _start_itunes_category(self, attrs_d):
        self._add_tag(attrs_d.get('text'), 'http://www.itunes.com/', None)
        self.push('category', 1)

    def _start_itunes_image(self, attrs_d):
        self.push('itunes_image', 0)
        if attrs_d.get('href'):
            self._get_context()['image'] = FeedParserDict({'href': attrs_d.get('href')})
        elif attrs_d.get('url'):

            self._get_context()['image'] = FeedParserDict({'href': attrs_d.get('url')})