from __future__ import unicode_literals from hypebot.commands import command_lib from hypebot.core import factory_lib # pylint: disable=unused-import # Importing commands before constructing the factory. import hypebot.commands.bash_commands import hypebot.commands.bling_commands import hypebot.commands.deploy_commands import hypebot.commands.hypecoin_commands import hypebot.commands.hypestack_commands import hypebot.commands.interface_commands import hypebot.commands.inventory_commands import hypebot.commands.league.lcs_commands import hypebot.commands.league.lol_commands import hypebot.commands.league.summoner_commands import hypebot.commands.league.trivia_commands import hypebot.commands.public_commands import hypebot.commands.remote_commands import hypebot.commands.simple_commands # pylint: enable=usused-import _factory = factory_lib.Factory(command_lib.BaseCommand) # Creates a command instance for the registered name. # ARGS: # name: {string} The registered name. # params: {HypeParams} Parameter overrides. # *args: Arguments to be passed to the subclass' constructor. Create = _factory.Create # pylint: disable=invalid-name
# 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. """Creates proper storage engine based on params.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hypebot.core import factory_lib from hypebot.storage import storage_lib # pylint: disable=unused-import from hypebot.storage import memstore_lib from hypebot.storage import redis_lib # pylint: enable=unused-import _factory = factory_lib.Factory(storage_lib.HypeStore, register_internal_nodes=True) # Creates a storage instance for the registered name. Create = _factory.Create # pylint: disable=invalid-name CreateFromParams = _factory.CreateFromParams # pylint: disable=invalid-name
# 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. """Factory for building stock markets.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hypebot.core import factory_lib from hypebot.stocks import stock_lib # pylint: disable=unused-import # Importing commands registers them with factory. import hypebot.stocks.iex_stock # pylint: enable=usused-import _factory = factory_lib.Factory(stock_lib.StockLib) Create = _factory.Create # pylint: disable=invalid-name CreateFromParams = _factory.CreateFromParams # pylint: disable=invalid-name
# # 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. """Factory for building news aggregators.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hypebot.core import factory_lib from hypebot.news import news_lib # pylint: disable=unused-import # Importing commands registers them with factory. import hypebot.news.nytimes_news # pylint: enable=usused-import _factory = factory_lib.Factory(news_lib.NewsLib) Create = _factory.Create # pylint: disable=invalid-name CreateFromParams = _factory.CreateFromParams # pylint: disable=invalid-name
# 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. """Factory for building interfaces. Hypebot is like Amumu and wants friends. Hypebot wants to talk to you. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hypebot.core import factory_lib from hypebot.interfaces import interface_lib # pylint: disable=unused-import # Importing commands registers them with factory. import hypebot.interfaces.capture_interface import hypebot.interfaces.discord_interface import hypebot.interfaces.terminal_interface # pylint: enable=usused-import _factory = factory_lib.Factory(interface_lib.BaseChatInterface) Create = _factory.Create # pylint: disable=invalid-name CreateFromParams = _factory.CreateFromParams # pylint: disable=invalid-name
for _ in range(self.ROLLS_PER_PURSE): purse = random.choice(list(self.COIN_PURSE_AMOUNTS.values())) coin_amt = purse.base while random.random() < purse.inc_chance: coin_amt += purse.inc_amount text += [ '%s found a roll of %d HypeCoins!' % (self._user, coin_amt) ] total_coin_amt += coin_amt payment_succeeded = self._core.bank.ProcessPayment( coin_lib.MINT_ACCOUNT, self._user, total_coin_amt, 'Coin purse reward', self._core.Reply) return (text, payment_succeeded) _factory = factory_lib.Factory(BaseItem) Create = _factory.Create # pylint: disable=invalid-name class InventoryManager(object): """Class that manages an inventory.""" INVENTORY_SUBKEY = 'inventory' def __init__(self, store: storage_lib.HypeStore): self._store = store def GetUserInventory(self, user: Text) -> types.JsonType: return self._store.GetJsonValue(user, self.INVENTORY_SUBKEY) or {} def AddItem(self, user: Text, item: BaseItem) -> bool:
# # 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. """Creates desired proxy.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from hypebot.core import factory_lib from hypebot.proxies import proxy_lib # pylint: disable=unused-import,g-bad-import-order from hypebot.proxies import empty_proxy from hypebot.proxies import requests_proxy # pylint: enable=unused-import,g-bad-import-order _factory = factory_lib.Factory(proxy_lib.Proxy) # Creates a proxy instance for the registered name. Create = _factory.Create # pylint: disable=invalid-name