# Path: hypebot/core/params_lib.py
# def _ParseChannel(channel):
# def _ParseChannels(channels):
#   def __init__(self, defaults=None):
#   def __str__(self):
#   def Override(self, params):
#   def _AssignValueConvertDict(self, key, value):
#   def _ParseDict(self, params):
#   def __setattr__(self, key, value):
#   def get(self, key, default_value=None):  # pylint: disable=invalid-name
#   def AsDict(self):
#   def Lock(self):
#   def _RaiseIfLocked(self):
# def MergeParams(defaults, *overrides):
# class HypeParams(object):
#   SPECIAL_ATTRS = ['_locked']
#   HAS_DYNAMIC_ATTRIBUTES = True
# 
# Path: hypebot/core/util_lib.py
# def Access(obj, path, default=None):
# def ArrowTime(hour=0, minute=0, second=0, tz='UTC', weekday=None):
# def CanonicalizeName(raw_name: Text):
# def UnformatHypecoins(value):
# def ExtractRegex(pattern: Text,
#                  string: Text) -> Optional[Tuple[List[Text], Text]]:
# def FormatHypecoins(amount, abbreviate=False):
# def SafeCast(value, desired_type, default=None):
# def TimeDeltaToHumanDuration(time_delta, precision=1):
# def SafeUrl(url, params=None):
#   def __init__(self, items: Iterable[Text],
#                initial_weights: Optional[Iterable[float]] = None):
#   def Freeze(self):
#   def GetItem(self) -> Text:
#   def GetWeight(self, item: Text) -> Optional[float]:
#   def GetAndDownweightItem(self) -> Text:
#   def ModifyWeight(self, item: Text, update_fn: Callable[[float],
#                                                          float]) -> float:
#   def _NormalizeProbs(self):
# def Bold(string):
# def Italic(string):
# def Underline(string):
# def Colorize(string, color, irc=True):
# def StripColor(string):
# def Dankify(string):
# def FuzzyBool(value):
# def Sparkline(values):
#   def __init__(self, user: user_pb2.User):
#   def __init__(self):
#   def RecordActivity(self, user: user_pb2.User, channel: channel_pb2.Channel):
#   def LastActivity(self, user: user_pb2.User):
#   def AddUser(self,
#               user: user_pb2.User,
#               channel: Optional[channel_pb2.Channel] = None):
#   def AllHumans(self, channel: Optional[channel_pb2.Channel] = None):
#   def AllBots(self, channel: Optional[channel_pb2.Channel] = None):
#   def AllUsers(self, channel: Optional[channel_pb2.Channel] = None):
# def MatchesAny(channels, channel):
# def _CardAsTextList(card: message_pb2.Card) -> List[Text]:
# def _AppendToMessage(msg: hype_types.Message,
#                      response: hype_types.CommandResponse):
# def MakeMessage(response: hype_types.CommandResponse) -> hype_types.Message:
# DECIMAL_POWERS = ('', 'k', 'm', 'b', 't', 'q', 'p')
#   YEAR_IN_DAYS = 365.25  # Approximate.
#   MONTH_IN_DAYS = YEAR_IN_DAYS / 12.0  # Average.
#   HOUR_IN_SECONDS = 60 * 60.0
#   MINUTE_IN_SECONDS = 60.0
# _MIRC_COLORS = {
#     'white': (0, '#ffffff'),
#     'black': (1, '#000000'),
#     'blue': (2, '#000075'),
#     'green': (3, '#009300'),
#     'red': (4, '#ff0000'),
#     'brown': (5, '#750000'),
#     'purple': (6, '#9c009c'),
#     'orange': (7, '#fc7500'),
#     'yellow': (8, '#ffff00'),
#     'light green': (9, '#00fc00'),
#     'cyan': (10, '#009393'),
#     'light cyan': (11, '#00ffff'),
#     'light blue': (12, '#0000fc'),
#     'pink': (13, '#ff00ff'),
#     'grey': (14, '#757575'),
#     'light grey': (15, '#d2d2d2'),
# }
# class WeightedCollection(object):
# class _UserTrack(object):
# class UserTracker(object):
# 
# Path: hypebot/news/news_lib.py
# class NewsLib(with_metaclass(abc.ABCMeta)):
#   DEFAULT_PARAMS = params_lib.HypeParams({})
#   def __init__(self, params, proxy):
#   def source(self) -> Text:
#   def icon(self) -> 'message_pb2.Card.Image':
#   def GetHeadlines(self,
#                    query: Text,
#                    max_results: int = 5) -> List[Dict[Text, Any]]:
#   def GetTrending(self, max_results: int = 5) -> List[Dict[Text, Any]]:


import arrow
from hypebot.core import params_lib
from hypebot.core import util_lib
from hypebot.news import news_lib
from hypebot.protos import message_pb2
# Copyright 2020 The Hypebot Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Implementation of news_lib.NewsLib powered by NYTimes."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals




class NYTimesNews(news_lib.NewsLib):
  """Data provided by The New York Times."""

  DEFAULT_PARAMS = params_lib.MergeParams(

# Path: hypebot/core/params_lib.py
# def _ParseChannel(channel):
# def _ParseChannels(channels):
#   def __init__(self, defaults=None):
#   def __str__(self):
#   def Override(self, params):
#   def _AssignValueConvertDict(self, key, value):
#   def _ParseDict(self, params):
#   def __setattr__(self, key, value):
#   def get(self, key, default_value=None):  # pylint: disable=invalid-name
#   def AsDict(self):
#   def Lock(self):
#   def _RaiseIfLocked(self):
# def MergeParams(defaults, *overrides):
# class HypeParams(object):
#   SPECIAL_ATTRS = ['_locked']
#   HAS_DYNAMIC_ATTRIBUTES = True
# 
# Path: hypebot/core/util_lib.py
# def Access(obj, path, default=None):
# def ArrowTime(hour=0, minute=0, second=0, tz='UTC', weekday=None):
# def CanonicalizeName(raw_name: Text):
# def UnformatHypecoins(value):
# def ExtractRegex(pattern: Text,
#                  string: Text) -> Optional[Tuple[List[Text], Text]]:
# def FormatHypecoins(amount, abbreviate=False):
# def SafeCast(value, desired_type, default=None):
# def TimeDeltaToHumanDuration(time_delta, precision=1):
# def SafeUrl(url, params=None):
#   def __init__(self, items: Iterable[Text],
#                initial_weights: Optional[Iterable[float]] = None):
#   def Freeze(self):
#   def GetItem(self) -> Text:
#   def GetWeight(self, item: Text) -> Optional[float]:
#   def GetAndDownweightItem(self) -> Text:
#   def ModifyWeight(self, item: Text, update_fn: Callable[[float],
#                                                          float]) -> float:
#   def _NormalizeProbs(self):
# def Bold(string):
# def Italic(string):
# def Underline(string):
# def Colorize(string, color, irc=True):
# def StripColor(string):
# def Dankify(string):
# def FuzzyBool(value):
# def Sparkline(values):
#   def __init__(self, user: user_pb2.User):
#   def __init__(self):
#   def RecordActivity(self, user: user_pb2.User, channel: channel_pb2.Channel):
#   def LastActivity(self, user: user_pb2.User):
#   def AddUser(self,
#               user: user_pb2.User,
#               channel: Optional[channel_pb2.Channel] = None):
#   def AllHumans(self, channel: Optional[channel_pb2.Channel] = None):
#   def AllBots(self, channel: Optional[channel_pb2.Channel] = None):
#   def AllUsers(self, channel: Optional[channel_pb2.Channel] = None):
# def MatchesAny(channels, channel):
# def _CardAsTextList(card: message_pb2.Card) -> List[Text]:
# def _AppendToMessage(msg: hype_types.Message,
#                      response: hype_types.CommandResponse):
# def MakeMessage(response: hype_types.CommandResponse) -> hype_types.Message:
# DECIMAL_POWERS = ('', 'k', 'm', 'b', 't', 'q', 'p')
#   YEAR_IN_DAYS = 365.25  # Approximate.
#   MONTH_IN_DAYS = YEAR_IN_DAYS / 12.0  # Average.
#   HOUR_IN_SECONDS = 60 * 60.0
#   MINUTE_IN_SECONDS = 60.0
# _MIRC_COLORS = {
#     'white': (0, '#ffffff'),
#     'black': (1, '#000000'),
#     'blue': (2, '#000075'),
#     'green': (3, '#009300'),
#     'red': (4, '#ff0000'),
#     'brown': (5, '#750000'),
#     'purple': (6, '#9c009c'),
#     'orange': (7, '#fc7500'),
#     'yellow': (8, '#ffff00'),
#     'light green': (9, '#00fc00'),
#     'cyan': (10, '#009393'),
#     'light cyan': (11, '#00ffff'),
#     'light blue': (12, '#0000fc'),
#     'pink': (13, '#ff00ff'),
#     'grey': (14, '#757575'),
#     'light grey': (15, '#d2d2d2'),
# }
# class WeightedCollection(object):
# class _UserTrack(object):
# class UserTracker(object):
# 
# Path: hypebot/news/news_lib.py
# class NewsLib(with_metaclass(abc.ABCMeta)):
#   DEFAULT_PARAMS = params_lib.HypeParams({})
#   def __init__(self, params, proxy):
#   def source(self) -> Text:
#   def icon(self) -> 'message_pb2.Card.Image':
#   def GetHeadlines(self,
#                    query: Text,
#                    max_results: int = 5) -> List[Dict[Text, Any]]:
#   def GetTrending(self, max_results: int = 5) -> List[Dict[Text, Any]]:


# Path: hypebot/news/nytimes_news.py
import arrow
from hypebot.core import params_lib
from hypebot.core import util_lib
from hypebot.news import news_lib
from hypebot.protos import message_pb2

# Copyright 2020 The Hypebot Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Implementation of news_lib.NewsLib powered by NYTimes."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals




class NYTimesNews(news_lib.NewsLib):
  """Data provided by The New York Times."""

  DEFAULT_PARAMS = params_lib.MergeParams(

      news_lib.NewsLib.DEFAULT_PARAMS,