# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from __future__ import absolute_import # The bot commands implemented in here are present no matter which module is loaded import base64 import imp import socket import traceback import threading from irc.parse import parse_nick import time from src import decorators, logging,commands import config log = logging("logs/errors.log").log alog = logging(None).log locky = threading.RLock() hook = decorators.hook def notify_error(cli, chan, target_logger,ctcp=False): if ctcp: msg = "An error has occurred while processing a ctcp request and has been logged." else: msg = "An error has occurred and has been logged." tb = traceback.format_exc() target_logger(tb) with locky: try:
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from __future__ import absolute_import # The bot commands implemented in here are present no matter which module is loaded import base64 import imp import socket import traceback import threading from irc.parse import parse_nick import time from src import decorators, logging,commands2 import config log = logging("logs/errors.log").log alog = logging(None).log locky = threading.RLock() hook = decorators.hook def notify_error(cli, chan, target_logger,ctcp=False): if ctcp: msg = "An error has occurred while processing a ctcp request and has been logged." else: msg = "An error has occurred and has been logged." tb = traceback.format_exc() target_logger(tb) with locky: try:
import ssl import sys import threading import time import time import datetime import irc import traceback from parse import * import os import base64 import src from src import logging rawlog = logging('raw.log').log argsa=src.args date = str(datetime.date.today()) class TokenBucket(object): """An implementation of the token bucket algorithm. >>> bucket = TokenBucket(80, 0.5) >>> bucket.consume(1) """ def __init__(self, tokens, fill_rate): """tokens is the total tokens in the bucket. fill_rate is the rate in tokens/second that the bucket will be refilled.""" self.capacity = float(tokens) self._tokens = float(tokens) self.fill_rate = float(fill_rate)
import ssl import sys import threading import time import time import datetime import irc import traceback from parse import * import os import base64 import src from src import logging rawlog = logging('raw.log').log argsa = src.args date = str(datetime.date.today()) class TokenBucket(object): """An implementation of the token bucket algorithm. >>> bucket = TokenBucket(80, 0.5) >>> bucket.consume(1) """ def __init__(self, tokens, fill_rate): """tokens is the total tokens in the bucket. fill_rate is the rate in tokens/second that the bucket will be refilled.""" self.capacity = float(tokens) self._tokens = float(tokens)