code clean
code clean
This commit is contained in:
parent
5c2ab81e16
commit
1847ea5f34
14 changed files with 54 additions and 22 deletions
|
|
@ -30,7 +30,6 @@ class Weboorrents(ConsoleApplication):
|
|||
APPNAME = 'weboorrents'
|
||||
VERSION = '0.1'
|
||||
COPYRIGHT = 'Copyright(C) 2010 Romain Bignon'
|
||||
CONFIG = {}
|
||||
|
||||
def main(self, argv):
|
||||
self.load_configured_backends(ICapTorrent)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@ from weboob.capabilities.travel import ICapTravel, Station, Departure
|
|||
|
||||
from .browser import CanalTP
|
||||
|
||||
|
||||
__all__ = ['CanalTPBackend']
|
||||
|
||||
|
||||
class CanalTPBackend(BaseBackend, ICapTravel):
|
||||
NAME = 'canaltp'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
|
|
|
|||
|
|
@ -17,13 +17,17 @@
|
|||
|
||||
from __future__ import with_statement
|
||||
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.tools.backend import BaseBackend
|
||||
from weboob.tools.browser import BrowserUnavailable
|
||||
from weboob.capabilities.messages import ICapMessages, ICapMessagesReply, Message
|
||||
|
||||
from .feeds import ArticlesList
|
||||
from .browser import DLFP
|
||||
|
||||
|
||||
__all__ = ['DLFPBackend']
|
||||
|
||||
|
||||
class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesReply):
|
||||
NAME = 'dlfp'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
|
|
|
|||
|
|
@ -15,15 +15,20 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
|
||||
from __future__ import with_statement
|
||||
|
||||
from logging import warning
|
||||
|
||||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.messages import ICapMessages, Message
|
||||
from weboob.tools.backend import BaseBackend
|
||||
|
||||
from .browser import FourChan
|
||||
|
||||
|
||||
__all__ = ['FourChanBackend']
|
||||
|
||||
|
||||
class FourChanBackend(BaseBackend, ICapMessages):
|
||||
NAME = 'fourchan'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
|
|
@ -32,7 +37,7 @@ class FourChanBackend(BaseBackend, ICapMessages):
|
|||
LICENSE = 'GPLv3'
|
||||
DESCRIPTION = "4chan website"
|
||||
|
||||
CONFIG = {'boards': BaseBackend.ConfigField(description='Boards'),
|
||||
CONFIG = {'boards': BaseBackend.ConfigField(description='Boards'),
|
||||
}
|
||||
STORAGE = {'boards': {}}
|
||||
BROWSER = FourChan
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ class GazelleBackend(BaseBackend, ICapTorrent):
|
|||
DESCRIPTION = 'gazelle bittorrent tracker'
|
||||
LICENSE = 'GPLv3'
|
||||
|
||||
CONFIG = {'username': BaseBackend.ConfigField(description='Username on website'),
|
||||
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True),
|
||||
'protocol': BaseBackend.ConfigField(description='Protocol to use ("http" or "https")', regexp='^(http|https)$'),
|
||||
'domain': BaseBackend.ConfigField(description='Domain (example "ssl.what.cd")'),
|
||||
CONFIG = {'username': BaseBackend.ConfigField(description='Username on website'),
|
||||
'password': BaseBackend.ConfigField(description='Password of account', is_masked=True),
|
||||
'protocol': BaseBackend.ConfigField(description='Protocol to use ("http" or "https")', regexp='^(http|https)$'),
|
||||
'domain': BaseBackend.ConfigField(description='Domain (example "ssl.what.cd")'),
|
||||
}
|
||||
BROWSER = GazelleBrowser
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ class InaBackend(BaseBackend, ICapVideo):
|
|||
DESCRIPTION = 'INA french video archives'
|
||||
LICENSE = 'GPLv3'
|
||||
|
||||
CONFIG = {}
|
||||
BROWSER = InaBrowser
|
||||
|
||||
def get_video(self, _id):
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ from weboob.tools.browser import BasePage
|
|||
from ..video import InaVideo
|
||||
|
||||
|
||||
__ALL__ = ['VideoPage']
|
||||
__all__ = ['VideoPage']
|
||||
|
||||
|
||||
class VideoPage(BasePage):
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ class YoujizzBackend(BaseBackend, ICapVideo):
|
|||
DESCRIPTION = 'Youjizz videos website'
|
||||
LICENSE = 'GPLv3'
|
||||
|
||||
CONFIG = {}
|
||||
BROWSER = YoujizzBrowser
|
||||
|
||||
def get_video(self, _id):
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ class YoupornBackend(BaseBackend, ICapVideo):
|
|||
DESCRIPTION = 'Youporn videos website'
|
||||
LICENSE = 'GPLv3'
|
||||
|
||||
CONFIG = {}
|
||||
BROWSER = YoupornBrowser
|
||||
|
||||
def get_video(self, _id):
|
||||
|
|
|
|||
|
|
@ -33,5 +33,5 @@ class PornPage(BasePage):
|
|||
self.browser.select_form(nr=0)
|
||||
self.browser.submit(name='user_choice')
|
||||
return False
|
||||
except (ControlNotFoundError,FormNotFoundError):
|
||||
except (ControlNotFoundError, FormNotFoundError):
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ from xml.dom import minidom
|
|||
from weboob.core.backend import BaseBackend
|
||||
from weboob.capabilities.weather import ICapWeather, CityNotFound, Current, Forecast
|
||||
|
||||
|
||||
__all__ = ['YWeatherBackend']
|
||||
|
||||
|
||||
class YWeatherBackend(BaseBackend, ICapWeather):
|
||||
NAME = 'yweather'
|
||||
MAINTAINER = 'Romain Bignon'
|
||||
|
|
@ -59,4 +63,5 @@ class YWeatherBackend(BaseBackend, ICapWeather):
|
|||
int(forecast.getAttribute('low')),
|
||||
int(forecast.getAttribute('high')),
|
||||
forecast.getAttribute('text'),
|
||||
'C')
|
||||
'C',
|
||||
)
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@
|
|||
from .cap import ICap
|
||||
|
||||
|
||||
__all__ = ['ICapDating', 'Profile']
|
||||
__all__ = ['ICapDating']
|
||||
|
||||
|
||||
class OptimizationNotFound(Exception): pass
|
||||
class OptimizationNotFound(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Optimization(object):
|
||||
def start(self):
|
||||
|
|
@ -31,6 +33,7 @@ class Optimization(object):
|
|||
def stop(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class StatusField(object):
|
||||
FIELD_TEXT = 0x001 # the value is a long text
|
||||
FIELD_HTML = 0x002 # the value is HTML formated
|
||||
|
|
@ -41,6 +44,7 @@ class StatusField(object):
|
|||
self.value = value
|
||||
self.flags = flags
|
||||
|
||||
|
||||
class ICapDating(ICap):
|
||||
def get_status(self):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -50,27 +50,42 @@ __all__ = ['BrowserIncorrectPassword', 'BrowserBanned', 'BrowserUnavailable', 'B
|
|||
class BrowserIncorrectPassword(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BrowserBanned(BrowserIncorrectPassword):
|
||||
pass
|
||||
|
||||
|
||||
class BrowserUnavailable(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class BrowserRetry(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class ExpectedElementNotFound(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class NoHistory(object):
|
||||
"""
|
||||
We don't want to fill memory with history
|
||||
"""
|
||||
def __init__(self): pass
|
||||
def add(self, request, response): pass
|
||||
def back(self, n, _response): pass
|
||||
def clear(self): pass
|
||||
def close(self): pass
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def add(self, request, response):
|
||||
pass
|
||||
|
||||
def back(self, n, _response):
|
||||
pass
|
||||
|
||||
def clear(self):
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
|
||||
|
||||
class BasePage(object):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
|
||||
from copy import deepcopy
|
||||
from logging import error
|
||||
|
||||
from .config.yamlconfig import YamlConfig
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue