Refractoring double code
This commit is contained in:
parent
74e7152d5f
commit
79cf15b95c
@ -28,10 +28,6 @@ class ChemSpider(Source):
|
|||||||
|
|
||||||
def __init__(self, config=None):
|
def __init__(self, config=None):
|
||||||
Source.__init__(self, config)
|
Source.__init__(self, config)
|
||||||
if self.cfg is None:
|
|
||||||
self.cfg = {}
|
|
||||||
else:
|
|
||||||
self.cfg = config
|
|
||||||
self.ignore_list = []
|
self.ignore_list = []
|
||||||
if 'token' not in self.cfg or self.cfg['token'] == '':
|
if 'token' not in self.cfg or self.cfg['token'] == '':
|
||||||
log.msg('ChemSpider token not set or empty, search/MassSpec API '
|
log.msg('ChemSpider token not set or empty, search/MassSpec API '
|
||||||
|
@ -25,10 +25,6 @@ class NIST(Source):
|
|||||||
def __init__(self, config=None):
|
def __init__(self, config=None):
|
||||||
Source.__init__(self, config)
|
Source.__init__(self, config)
|
||||||
self.ignore_list = set()
|
self.ignore_list = set()
|
||||||
if config is None:
|
|
||||||
self.cfg = {}
|
|
||||||
else:
|
|
||||||
self.cfg = config
|
|
||||||
|
|
||||||
def parse(self, response):
|
def parse(self, response):
|
||||||
sel = Selector(response)
|
sel = Selector(response)
|
||||||
|
@ -21,10 +21,6 @@ class WikipediaParser(Source):
|
|||||||
|
|
||||||
def __init__(self, config=None):
|
def __init__(self, config=None):
|
||||||
Source.__init__(self, config)
|
Source.__init__(self, config)
|
||||||
if config is None:
|
|
||||||
self.cfg = {}
|
|
||||||
else:
|
|
||||||
self.cfg = config
|
|
||||||
|
|
||||||
def parse(self, response):
|
def parse(self, response):
|
||||||
"""
|
"""
|
||||||
|
@ -10,6 +10,9 @@ class Source:
|
|||||||
"""
|
"""
|
||||||
Initiation of a new Source
|
Initiation of a new Source
|
||||||
"""
|
"""
|
||||||
|
self.cfg = {}
|
||||||
|
if config is not None:
|
||||||
|
self.cfg = config
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def parse(self, response):
|
def parse(self, response):
|
||||||
|
Reference in New Issue
Block a user