Permalink
Browse files

Moved all utils from tbutil to utils

  • Loading branch information...
1 parent d2b0095 commit 2b3e09307da424b1ba19092c9e77d17ef7f5a723 @pajlada committed Sep 19, 2016
View
@@ -10,7 +10,7 @@
sys.path.append(os.path.dirname(os.path.abspath(__file__ + '/..')))
from pajbot.bot import Bot
-from pajbot.tbutil import load_config
+from pajbot.utils import load_config
from pajbot.models.webcontent import WebContent
from pajbot.modules import PredictModule
from pajbot.models.roulette import Roulette
@@ -37,7 +37,7 @@
# from pajbot.models.command import Command
# from pajbot.models import *
-# from pajbot.tbutil import load_config
+# from pajbot.utils import load_config
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
@@ -22,7 +22,7 @@
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import relationship
-from pajbot.tbutil import load_config
+from pajbot.utils import load_config
from pajbot.managers.redis import RedisManager
Session = sessionmaker()
@@ -27,7 +27,7 @@
from sqlalchemy import Integer
from sqlalchemy import String
-from pajbot.tbutil import load_config
+from pajbot.utils import load_config
from pajbot.managers.redis import RedisManager
Session = sessionmaker()
View
@@ -2,7 +2,7 @@
import argparse
import pajbot.web
-from pajbot.tbutil import init_logging
+from pajbot.utils import init_logging
from pajbot.web import app
View
@@ -18,7 +18,7 @@
def run(args):
- from pajbot.tbutil import load_config
+ from pajbot.utils import load_config
config = load_config(args.config)
if 'main' not in config:
@@ -54,7 +54,7 @@ def handle_exceptions(exctype, value, tb):
log.error('Logging an uncaught exception', exc_info=(exctype, value, tb))
if __name__ == '__main__':
- from pajbot.tbutil import init_logging
+ from pajbot.utils import init_logging
sys.excepthook = handle_exceptions
View
@@ -37,8 +37,8 @@
from pajbot.models.stream import StreamManager
from pajbot.models.timer import TimerManager
from pajbot.streamhelper import StreamHelper
-from pajbot.tbutil import time_method
-from pajbot.tbutil import time_since
+from pajbot.utils import time_method
+from pajbot.utils import time_since
log = logging.getLogger(__name__)
@@ -117,7 +117,7 @@ def load_config(self, config):
def __init__(self, config, args=None):
# Load various configuration variables from the given config object
# The config object that should be passed through should
- # come from pajbot.tbutil.load_config
+ # come from pajbot.utils.load_config
self.load_config(config)
# Update the database scheme if necessary using alembic
@@ -9,7 +9,7 @@
from pajbot.models.command import CommandData
from pajbot.models.command import CommandExample
from pajbot.models.command import parse_command_for_web
-from pajbot.tbutil import find
+from pajbot.utils import find
log = logging.getLogger(__name__)
@@ -8,7 +8,7 @@
from irc.client import MessageTooLong
from irc.client import ServerNotConnectedError
-import pajbot.tbutil
+from pajbot.utils import find
log = logging.getLogger('pajbot')
@@ -190,9 +190,9 @@ def on_disconnect(self, chatconn):
def privmsg(self, channel, message, increase_message=True):
if increase_message:
- conn = pajbot.tbutil.find(lambda c: c.conn.is_connected() and c.num_msgs_sent < self.message_limit, self.connlist)
+ conn = find(lambda c: c.conn.is_connected() and c.num_msgs_sent < self.message_limit, self.connlist)
else:
- conn = pajbot.tbutil.find(lambda c: c.conn.is_connected(), self.connlist)
+ conn = find(lambda c: c.conn.is_connected(), self.connlist)
if conn is None:
log.error('No available connections to send messages from. Delaying message a few seconds.')
@@ -1,7 +1,7 @@
import logging
import operator
-from pajbot.tbutil import find
+from pajbot.utils import find
log = logging.getLogger('pajbot')
@@ -5,8 +5,8 @@
from pajbot.managers.db import DBManager
from pajbot.models.twitter import TwitterUser
-from pajbot.tbutil import time_since
-from pajbot.tbutil import tweet_prettify_urls
+from pajbot.utils import time_since
+from pajbot.utils import tweet_prettify_urls
log = logging.getLogger(__name__)
@@ -71,7 +71,7 @@ def find_static(username, db_session=None):
Returns a user object if the user already existed, otherwise return None
"""
- # from pajbot.tbutil import print_traceback
+ # from pajbot.utils import print_traceback
# print_traceback()
# log.debug('UserManager::find({})'.format(username))
@@ -103,7 +103,7 @@ def find(self, username, db_session=None):
Returns a user object if the user already existed, otherwise return None
"""
- # from pajbot.tbutil import print_traceback
+ # from pajbot.utils import print_traceback
# print_traceback()
# log.debug('UserManager::find({})'.format(username))
@@ -12,7 +12,7 @@
from pajbot.managers.db import Base
from pajbot.managers.db import DBManager
-from pajbot.tbutil import find
+from pajbot.utils import find
log = logging.getLogger('pajbot')
@@ -6,7 +6,7 @@
from sqlalchemy import String
from pajbot.managers.db import Base
-from pajbot.tbutil import time_ago
+from pajbot.utils import time_ago
log = logging.getLogger(__name__)
@@ -9,7 +9,7 @@
from pajbot.managers.db import Base
from pajbot.managers.db import DBManager
-from pajbot.tbutil import find
+from pajbot.utils import find
log = logging.getLogger('pajbot')
@@ -11,7 +11,7 @@
from pajbot.managers.db import Base
from pajbot.managers.db import DBManager
from pajbot.models.action import ActionParser
-from pajbot.tbutil import find
+from pajbot.utils import find
log = logging.getLogger('pajbot')
@@ -16,7 +16,7 @@
from pajbot.managers.schedule import ScheduleManager
from pajbot.managers.time import TimeManager
from pajbot.streamhelper import StreamHelper
-from pajbot.tbutil import time_method # NOQA
+from pajbot.utils import time_method # NOQA
log = logging.getLogger(__name__)
@@ -117,7 +117,7 @@ def sql_load(self):
self.model_loaded = True
log.debug('[UserSQL] Loading user model for {}'.format(self.username))
- # from pajbot.tbutil import print_traceback
+ # from pajbot.utils import print_traceback
# print_traceback()
if self.shared_db_session:
@@ -1,6 +1,6 @@
import logging
-from pajbot.tbutil import find
+from pajbot.utils import find
log = logging.getLogger(__name__)
@@ -6,7 +6,7 @@
from pajbot.managers.user import UserManager
from pajbot.models.user import User
from pajbot.modules import BaseModule
-from pajbot.tbutil import time_method
+from pajbot.utils import time_method
log = logging.getLogger(__name__)
@@ -4,7 +4,7 @@
import pajbot.models
from pajbot.actions import ActionQueue
from pajbot.modules import BaseModule
-from pajbot.tbutil import time_since
+from pajbot.utils import time_since
log = logging.getLogger('pajbot')
@@ -8,7 +8,7 @@
from pajbot.actions import ActionQueue
from pajbot.modules import BaseModule
from pajbot.modules import ModuleSetting
-from pajbot.tbutil import time_limit
+from pajbot.utils import time_limit
log = logging.getLogger(__name__)
@@ -2,7 +2,7 @@
import pajbot.models
from pajbot.modules import BaseModule
-from pajbot.tbutil import time_since
+from pajbot.utils import time_since
log = logging.getLogger(__name__)
@@ -7,7 +7,7 @@
from pajbot.modules import BaseModule
from pajbot.modules import ModuleSetting
from pajbot.streamhelper import StreamHelper
-from pajbot.tbutil import find
+from pajbot.utils import find
log = logging.getLogger(__name__)
@@ -7,7 +7,7 @@
from pajbot.modules import BaseModule
from pajbot.modules import ModuleSetting
from pajbot.streamhelper import StreamHelper
-from pajbot.tbutil import time_since
+from pajbot.utils import time_since
log = logging.getLogger(__name__)
@@ -60,7 +60,7 @@ def refresh_emotes(cursor):
if __name__ == "__main__":
import sys
sys.path.append('../')
- from tbutil import load_config, init_logging
+ from utils import load_config, init_logging
init_logging('pajbot')
from apiwrappers import APIBase
import argparse
Oops, something went wrong.

0 comments on commit 2b3e093

Please sign in to comment.