Make plugins threaded
This commit is contained in:
parent
29a7ad73ff
commit
e2938f6d5e
|
@ -44,6 +44,7 @@ import requests
|
||||||
|
|
||||||
class Apixu(callbacks.Plugin):
|
class Apixu(callbacks.Plugin):
|
||||||
"""apixu weather api client"""
|
"""apixu weather api client"""
|
||||||
|
threaded = True
|
||||||
|
|
||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
self.__parent = super(Apixu, self)
|
self.__parent = super(Apixu, self)
|
||||||
|
|
|
@ -45,6 +45,7 @@ import timeago
|
||||||
|
|
||||||
class GitHub(callbacks.Plugin):
|
class GitHub(callbacks.Plugin):
|
||||||
"""GitHub rss commit reader"""
|
"""GitHub rss commit reader"""
|
||||||
|
threaded = True
|
||||||
|
|
||||||
def __parse_rss(self, url):
|
def __parse_rss(self, url):
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
|
|
|
@ -44,6 +44,7 @@ import requests
|
||||||
|
|
||||||
class Inquisicao(callbacks.Plugin):
|
class Inquisicao(callbacks.Plugin):
|
||||||
"""Client for Inquisicao"""
|
"""Client for Inquisicao"""
|
||||||
|
threaded = True
|
||||||
|
|
||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
self.__parent = super(Inquisicao, self)
|
self.__parent = super(Inquisicao, self)
|
||||||
|
|
|
@ -42,6 +42,7 @@ import requests
|
||||||
|
|
||||||
class Kernel(callbacks.Plugin):
|
class Kernel(callbacks.Plugin):
|
||||||
"""Get latest kernel versions"""
|
"""Get latest kernel versions"""
|
||||||
|
threaded = True
|
||||||
|
|
||||||
def __linus(self):
|
def __linus(self):
|
||||||
response = requests.get("https://www.kernel.org/releases.json")
|
response = requests.get("https://www.kernel.org/releases.json")
|
||||||
|
|
|
@ -99,6 +99,7 @@ LastFMDB = plugins.DB('LastFM',
|
||||||
|
|
||||||
class LastFM(callbacks.Plugin):
|
class LastFM(callbacks.Plugin):
|
||||||
"""Last.fm client"""
|
"""Last.fm client"""
|
||||||
|
threaded = True
|
||||||
|
|
||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
self.__parent = super(LastFM, self)
|
self.__parent = super(LastFM, self)
|
||||||
|
|
|
@ -43,6 +43,7 @@ import requests
|
||||||
|
|
||||||
class Maria(callbacks.Plugin):
|
class Maria(callbacks.Plugin):
|
||||||
"""MariaWeb client"""
|
"""MariaWeb client"""
|
||||||
|
threaded = True
|
||||||
|
|
||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
self.__parent = super(Maria, self)
|
self.__parent = super(Maria, self)
|
||||||
|
|
|
@ -46,6 +46,7 @@ from bs4 import BeautifulSoup
|
||||||
|
|
||||||
class Priberam(callbacks.Plugin):
|
class Priberam(callbacks.Plugin):
|
||||||
"""Priberam dictionary client"""
|
"""Priberam dictionary client"""
|
||||||
|
threaded = True
|
||||||
|
|
||||||
def __clean_str(self, text, clean_number=False):
|
def __clean_str(self, text, clean_number=False):
|
||||||
text = re.sub(r'\s+', ' ', text)
|
text = re.sub(r'\s+', ' ', text)
|
||||||
|
@ -81,7 +82,7 @@ class Priberam(callbacks.Plugin):
|
||||||
|
|
||||||
total = 0
|
total = 0
|
||||||
# Only count the definitions that begin with a number
|
# 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)):
|
for idx in range(len(definitions)):
|
||||||
if idx > 1 and self.__clean_str(definitions[idx].text)[:1].isdigit() is False:
|
if idx > 1 and self.__clean_str(definitions[idx].text)[:1].isdigit() is False:
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue