Make plugins threaded

This commit is contained in:
Pedro de Oliveira 2019-06-27 23:42:59 +01:00
parent 29a7ad73ff
commit e2938f6d5e
7 changed files with 8 additions and 1 deletions

View File

@ -44,6 +44,7 @@ import requests
class Apixu(callbacks.Plugin):
"""apixu weather api client"""
threaded = True
def __init__(self, irc):
self.__parent = super(Apixu, self)

View File

@ -45,6 +45,7 @@ import timeago
class GitHub(callbacks.Plugin):
"""GitHub rss commit reader"""
threaded = True
def __parse_rss(self, url):
response = requests.get(url)

View File

@ -44,6 +44,7 @@ import requests
class Inquisicao(callbacks.Plugin):
"""Client for Inquisicao"""
threaded = True
def __init__(self, irc):
self.__parent = super(Inquisicao, self)

View File

@ -42,6 +42,7 @@ import requests
class Kernel(callbacks.Plugin):
"""Get latest kernel versions"""
threaded = True
def __linus(self):
response = requests.get("https://www.kernel.org/releases.json")

View File

@ -99,6 +99,7 @@ LastFMDB = plugins.DB('LastFM',
class LastFM(callbacks.Plugin):
"""Last.fm client"""
threaded = True
def __init__(self, irc):
self.__parent = super(LastFM, self)

View File

@ -43,6 +43,7 @@ import requests
class Maria(callbacks.Plugin):
"""MariaWeb client"""
threaded = True
def __init__(self, irc):
self.__parent = super(Maria, self)

View File

@ -46,6 +46,7 @@ from bs4 import BeautifulSoup
class Priberam(callbacks.Plugin):
"""Priberam dictionary client"""
threaded = True
def __clean_str(self, text, clean_number=False):
text = re.sub(r'\s+', ' ', text)
@ -81,7 +82,7 @@ class Priberam(callbacks.Plugin):
total = 0
# Only count the definitions that begin with a number
# Or the first is there is just one
# Or the first, if there is only one, even without a number
for idx in range(len(definitions)):
if idx > 1 and self.__clean_str(definitions[idx].text)[:1].isdigit() is False:
break