cleaning some code (from MR #9)
This commit is contained in:
parent
67b7e72507
commit
37ee1e5a67
|
@ -20,7 +20,7 @@
|
||||||
# standard library imports
|
# standard library imports
|
||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
|
|
||||||
class AddTags(object):
|
class AddTags:
|
||||||
'''Add as many tags as possible depending on the tweet length'''
|
'''Add as many tags as possible depending on the tweet length'''
|
||||||
def __init__(self, tweet, tags):
|
def __init__(self, tweet, tags):
|
||||||
'''Constructor of AddTags class'''
|
'''Constructor of AddTags class'''
|
||||||
|
|
|
@ -25,7 +25,7 @@ import sys
|
||||||
|
|
||||||
__version__ = '0.5'
|
__version__ = '0.5'
|
||||||
|
|
||||||
class CliParse(object):
|
class CliParse:
|
||||||
'''CliParse class'''
|
'''CliParse class'''
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
'''Constructor for the CliParse class'''
|
'''Constructor for the CliParse class'''
|
||||||
|
|
|
@ -17,18 +17,17 @@
|
||||||
'''Get values of the configuration file'''
|
'''Get values of the configuration file'''
|
||||||
|
|
||||||
# standard library imports
|
# standard library imports
|
||||||
from configparser import SafeConfigParser, NoOptionError, NoSectionError
|
from configparser import SafeConfigParser
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import socket
|
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# 3rd party library imports
|
# 3rd party library imports
|
||||||
import feedparser
|
import feedparser
|
||||||
|
|
||||||
class ConfParse(object):
|
class ConfParse:
|
||||||
'''ConfParse class'''
|
'''ConfParse class'''
|
||||||
def __init__(self, clioptions):
|
def __init__(self, clioptions):
|
||||||
'''Constructor of the ConfParse class'''
|
'''Constructor of the ConfParse class'''
|
||||||
|
@ -46,7 +45,6 @@ class ConfParse(object):
|
||||||
config = SafeConfigParser()
|
config = SafeConfigParser()
|
||||||
if not config.read(os.path.expanduser(pathtoconfig)):
|
if not config.read(os.path.expanduser(pathtoconfig)):
|
||||||
sys.exit('Could not read config file')
|
sys.exit('Could not read config file')
|
||||||
|
|
||||||
# The feedparser section
|
# The feedparser section
|
||||||
if config.has_option('feedparser', 'accept_bozo_exceptions'):
|
if config.has_option('feedparser', 'accept_bozo_exceptions'):
|
||||||
self.accept_bozo_exceptions = config.getboolean('feedparser', 'accept_bozo_exceptions')
|
self.accept_bozo_exceptions = config.getboolean('feedparser', 'accept_bozo_exceptions')
|
||||||
|
@ -185,7 +183,7 @@ class ConfParse(object):
|
||||||
sys.exit('The parent directory of the cache file does not exist: {cachefileparent}'.format(cachefileparent=cachefileparent))
|
sys.exit('The parent directory of the cache file does not exist: {cachefileparent}'.format(cachefileparent=cachefileparent))
|
||||||
else:
|
else:
|
||||||
options['cachefile'] = self.clioptions.cachefile
|
options['cachefile'] = self.clioptions.cachefile
|
||||||
### cache limit
|
# cache limit
|
||||||
if config.has_section(section):
|
if config.has_section(section):
|
||||||
confoption = 'cache_limit'
|
confoption = 'cache_limit'
|
||||||
if config.has_option(section, confoption):
|
if config.has_option(section, confoption):
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
# Push values to a influxdb database
|
# Push values to a influxdb database
|
||||||
'''Push values to a influxdb database'''
|
'''Push values to a influxdb database'''
|
||||||
|
|
||||||
# standard libraries imports
|
|
||||||
import json
|
|
||||||
|
|
||||||
# 3rd party libraries imports
|
# 3rd party libraries imports
|
||||||
from influxdb import InfluxDBClient
|
from influxdb import InfluxDBClient
|
||||||
|
|
||||||
|
@ -38,5 +35,8 @@ class InfluxdbPlugin(object):
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
'''Main of the PiwikModule class'''
|
'''Main of the PiwikModule class'''
|
||||||
self.datatoinfluxdb.append({'measurement': self.plugininfo['measurement'], 'fields': {'value': self.data}})
|
self.datatoinfluxdb.append({
|
||||||
|
'measurement': self.plugininfo['measurement'],
|
||||||
|
'fields': {'value': self.data}
|
||||||
|
})
|
||||||
self.client.write_points(self.datatoinfluxdb)
|
self.client.write_points(self.datatoinfluxdb)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
# Remove duplicates from the final string before sending the tweet
|
# Remove duplicates from the final string before sending the tweet
|
||||||
'''Remove duplicates from the final string before sending the tweet'''
|
'''Remove duplicates from the final string before sending the tweet'''
|
||||||
|
|
||||||
class RemoveDuplicates(object):
|
class RemoveDuplicates:
|
||||||
'''Remove duplicates from the final string before sending the tweet'''
|
'''Remove duplicates from the final string before sending the tweet'''
|
||||||
def __init__(self, tweet):
|
def __init__(self, tweet):
|
||||||
'''Constructor of RemoveDuplicates class'''
|
'''Constructor of RemoveDuplicates class'''
|
||||||
|
|
Loading…
Reference in a new issue