diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-20 22:48:30 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-04-20 23:02:00 +0200 |
commit | 5a86c3cb1db6cd87bf9ae22e09dd209cecc0a363 (patch) | |
tree | d5fbe979c043f5aa684272c97c0305d3124b1901 | |
parent | PEP-8, Python Zen, refactor and reduce code (part 12 in master module/remote/... (diff) | |
download | pyload-5a86c3cb1db6cd87bf9ae22e09dd209cecc0a363.tar.xz |
Spare code cosmetics (8)
55 files changed, 150 insertions, 146 deletions
diff --git a/docs/build_docs.py b/docs/build_docs.py index 8a7ab7a18..05f34be44 100644 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -25,12 +25,12 @@ sys.path.append(dir_name) # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. @@ -50,7 +50,7 @@ templates_path = ['_templates'] source_suffix = '.rst' # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' @@ -79,37 +79,37 @@ release = '0.4.10' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- @@ -121,17 +121,17 @@ html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -149,44 +149,44 @@ html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a <link> tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'pyLoaddoc' @@ -195,10 +195,10 @@ htmlhelp_basename = 'pyLoaddoc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). @@ -209,26 +209,26 @@ latex_documents = [ # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- diff --git a/docs/docs.conf b/docs/docs.conf index 61a2c45ee..c5e619fd6 100644 --- a/docs/docs.conf +++ b/docs/docs.conf @@ -1,5 +1,6 @@ -#@NOTE: usage: epydoc --conf docs.conf , results goes to ~/.pyload/docs +#@NOTE: usage: epydoc --conf docs.conf +# results goes to ~/.pyload/docs [epydoc] diff --git a/docs/write_addons.rst b/docs/write_addons.rst index b7f6dfdb8..58e73e675 100644 --- a/docs/write_addons.rst +++ b/docs/write_addons.rst @@ -20,12 +20,15 @@ All addons should start with something like this: :: class YourAddon(Addon): - __name = "YourAddon" + __name = "YourAddon" + __tupe = "addon" __version = "0.1" + + __config = [("activated", "bool", "Activated", "True")] + __description = "Does really cool stuff" - __config = [ ("activated" , "bool" , "Activated" , "True" ) ] - __author_name__ = ("Me") - __author_mail__ = ("me@has-no-mail.com") + __license = "Your license short name" + __authors = [("Me", "me@has-no-mail.com")] All meta-data is defined in the header, you need at least one option at ``__config`` so the user can toggle your addon on and off. Dont't overwrite the ``init`` method if not neccesary, use ``setup`` instead. @@ -130,7 +133,7 @@ Sounds complicated but is very easy to do. Just use the ``Expose`` decorator: :: Thats all, it's available via the :class:`Api <pyload.api.Api>` now. If you want to use it read :ref:`access_api`. Here is a basic example: :: - #Assuming client is a ThriftClient or Api object + # Assuming client is a ThriftClient or Api object print client.getServices() print client.call(ServiceCall("YourAddon", "invoke", "an argument")) @@ -158,7 +161,7 @@ Just store everything in ``self.info``. :: Usable with: :: - #Assuming client is a ThriftClient or Api object + # Assuming client is a ThriftClient or Api object print client.getAllInfo() diff --git a/locale/pavement.py b/locale/pavement.py index cb2c6c01e..03acf3dcc 100644 --- a/locale/pavement.py +++ b/locale/pavement.py @@ -39,10 +39,10 @@ setup( author="pyLoad Team", author_email="support@pyload.org", platforms = ('Any',), - #package_dir={'pyload': "src"}, + # package_dir={'pyload': "src"}, packages=["pyload"], - #package_data=find_package_data(), - #data_files=[], + # package_data=find_package_data(), + # data_files=[], include_package_data=True, exclude_package_data={'pyload': ["docs*", "scripts*", "tests*"]}, #: exluced from build but not from sdist # 'bottle >= 0.10.0' not in list, because its small and contain little modifications @@ -53,7 +53,7 @@ setup( 'lightweight webserver': ['bjoern'], 'RSS plugins': ['feedparser'], }, - #setup_requires=["setuptools_hg"], + # setup_requires=["setuptools_hg"], entry_points={ 'console_scripts': [ 'pyLoadCore = pyLoadCore:main', @@ -152,8 +152,8 @@ def get_source(options): f = open(pyload / "__init__.py", "wb") f.close() - #options.setup.packages = find_packages() - #options.setup.package_data = find_package_data() + # options.setup.packages = find_packages() + # options.setup.package_data = find_package_data() @task @@ -191,7 +191,7 @@ def thrift(options): (outdir / "thriftgen").rmtree() (outdir / "gen-py").move(outdir / "thriftgen") - #create light ttypes + # create light ttypes from pyload.remote.socketbackend.create_ttypes import main main() diff --git a/pyload/Core.py b/pyload/Core.py index d1404d00f..ae6bde4a9 100755 --- a/pyload/Core.py +++ b/pyload/Core.py @@ -137,7 +137,7 @@ class Core(object): print "<Options>" print " -v, --version", " " * 10, "Print version to terminal" print " -c, --clear", " " * 12, "Delete all saved packages/links" - #print " -a, --add=<link/list>", " " * 2, "Add the specified links" + # print " -a, --add=<link/list>", " " * 2, "Add the specified links" print " -u, --user", " " * 13, "Manages users" print " -d, --debug", " " * 12, "Enable debug mode" print " -s, --setup", " " * 12, "Run Setup Assistant" @@ -339,10 +339,10 @@ class Core(object): self.log.debug("Remote activated: %s" % self.remote) self.check_install("Crypto", _("pycrypto to decode container files")) - #img = self.check_install("Image", _("Python Image Library (PIL) for captcha reading")) - #self.check_install("pycurl", _("pycurl to download any files"), True, True) + # img = self.check_install("Image", _("Python Image Library (PIL) for captcha reading")) + # self.check_install("pycurl", _("pycurl to download any files"), True, True) self.check_file("tmp", _("folder for temporary files"), True) - #tesser = self.check_install("tesseract", _("tesseract for captcha reading"), False) if os.name != "nt" else True + # tesser = self.check_install("tesseract", _("tesseract for captcha reading"), False) if os.name != "nt" else True self.captcha = True #: checks seems to fail, although tesseract is available @@ -379,7 +379,7 @@ class Core(object): self.scheduler = Scheduler(self) - #hell yeah, so many important managers :D + # hell yeah, so many important managers :D self.pluginManager = PluginManager(self) self.pullManager = PullManager(self) self.accountManager = AccountManager(self) @@ -417,7 +417,7 @@ class Core(object): if f.read().strip(): self.api.addPackage("links.txt", [link_file], 1) - #self.scheduler.addJob(0, self.accountManager.getAccountInfos) + # self.scheduler.addJob(0, self.accountManager.getAccountInfos) self.log.info(_("Activating Accounts...")) self.accountManager.getAccountInfos() @@ -592,7 +592,7 @@ class Core(object): if not file_exists and not quiet: if file_created: - #self.log.info( _("%s created") % description ) + # self.log.info( _("%s created") % description ) pass else: if not empty: diff --git a/pyload/api/__init__.py b/pyload/api/__init__.py index ab717525d..1c292d541 100644 --- a/pyload/api/__init__.py +++ b/pyload/api/__init__.py @@ -896,7 +896,7 @@ class Api(Iface): accounts = [AccountInfo(acc['validuntil'], acc['login'], acc['options'], acc['valid'], acc['trafficleft'], acc['maxtraffic'], acc['premium'], acc['type']) for acc in group] - return accounts or [] + return accounts or list() @permission(PERMS.ALL) @@ -909,9 +909,9 @@ class Api(Iface): @permission(PERMS.ACCOUNTS) - def updateAccount(self, plugin, account, password=None, options=None): + def updateAccount(self, plugin, account, password=None, options={}): """Changes pw/options for specific account.""" - self.core.accountManager.updateAccount(plugin, account, password, options or {}) + self.core.accountManager.updateAccount(plugin, account, password, options) @permission(PERMS.ACCOUNTS) diff --git a/pyload/config/Setup.py b/pyload/config/Setup.py index c879eb9e0..bae75fea4 100644 --- a/pyload/config/Setup.py +++ b/pyload/config/Setup.py @@ -32,9 +32,9 @@ class SetupAssistant(object): load_translation("setup", self.lang) - #Input shorthand for yes + # Input shorthand for yes self.yes = _("y") - #Input shorthand for no + # Input shorthand for no self.no = _("n") # print diff --git a/pyload/datatype/File.py b/pyload/datatype/File.py index 93aa636d7..0b6b5de46 100644 --- a/pyload/datatype/File.py +++ b/pyload/datatype/File.py @@ -58,7 +58,7 @@ class PyFile(object): self.lock = RLock() self.plugin = None - #self.download = None + # self.download = None self.waitUntil = 0 # time() + time to wait diff --git a/pyload/manager/Account.py b/pyload/manager/Account.py index 44a5e5c65..ac9944134 100644 --- a/pyload/manager/Account.py +++ b/pyload/manager/Account.py @@ -126,8 +126,8 @@ class AccountManager(object): f.write("\n") f.write(plugin + ":\n") - for name,data in accounts.iteritems(): - f.write("\n\t%s:%s\n" % (name,data['password']) ) + for name, data in accounts.iteritems(): + f.write("\n\t%s:%s\n" % (name, data['password']) ) if data['options']: for option, values in data['options'].iteritems(): f.write("\t@%s %s\n" % (option, " ".join(values))) @@ -147,12 +147,12 @@ class AccountManager(object): @lock - def updateAccount(self, plugin , user, password=None, options={}): + def updateAccount(self, plugin, user, password=None, options={}): """add or update account""" if plugin in self.accounts: p = self.getAccountPlugin(plugin) updated = p.updateAccounts(user, password, options) - #since accounts is a ref in plugin self.accounts doesnt need to be updated here + # since accounts is a ref in plugin self.accounts doesnt need to be updated here self.saveAccounts() if updated: p.scheduleRefresh(user, force=False) diff --git a/pyload/manager/Addon.py b/pyload/manager/Addon.py index 5ac56a349..a46b99b2e 100644 --- a/pyload/manager/Addon.py +++ b/pyload/manager/Addon.py @@ -169,7 +169,7 @@ class AddonManager(object): addon.deactivate() - #remove periodic call + # remove periodic call self.core.log.debug("Removed callback: %s" % self.core.scheduler.removeJob(addon.cb)) self.plugins.remove(addon) diff --git a/pyload/manager/thread/Addon.py b/pyload/manager/thread/Addon.py index 1da164543..b176e4e0c 100644 --- a/pyload/manager/thread/Addon.py +++ b/pyload/manager/thread/Addon.py @@ -58,7 +58,7 @@ class AddonThread(PluginThread): self.kwargs['thread'] = self self.f(*self.args, **self.kwargs) except TypeError, e: - #dirty method to filter out exceptions + # dirty method to filter out exceptions if "unexpected keyword argument 'thread'" not in e.args[0]: raise diff --git a/pyload/network/Browser.py b/pyload/network/Browser.py index 1015efd7e..482c2320a 100644 --- a/pyload/network/Browser.py +++ b/pyload/network/Browser.py @@ -91,7 +91,7 @@ class Browser(object): progressNotify=None, disposition=False): """ this can also download ftp """ self._size = 0 - self.dl = HTTPDownload(url, filename, get or {}, post or {}, self.lastEffectiveURL if ref else None, + self.dl = HTTPDownload(url, filename, get, post, self.lastEffectiveURL if ref else None, self.cj if cookies else None, self.bucket, self.options, progressNotify, disposition) name = self.dl.download(chunks, resume) self._size = self.dl.size diff --git a/pyload/network/HTTPDownload.py b/pyload/network/HTTPDownload.py index a266548cf..90169571c 100644 --- a/pyload/network/HTTPDownload.py +++ b/pyload/network/HTTPDownload.py @@ -82,7 +82,7 @@ class HTTPDownload(object): if self.info.getCount() > 1: with open(init, "rb+") as fo: #: first chunkfile for i in xrange(1, self.info.getCount()): - #input file + # input file fo.seek( self.info.getChunkRange(i - 1)[1] + 1) #: seek to beginning of chunk, to get rid of overlapping chunks fname = fs_encode("%s.chunk%d" % (self.filename, i)) @@ -178,7 +178,7 @@ class HTTPDownload(object): self.chunks.append(c) self.m.add_handle(handle) else: - #close immediatly + # close immediatly self.log.debug("Invalid curl handle -> closed") c.close() diff --git a/pyload/plugin/Addon.py b/pyload/plugin/Addon.py index bb90428e4..43de6732a 100644 --- a/pyload/plugin/Addon.py +++ b/pyload/plugin/Addon.py @@ -56,21 +56,21 @@ class Addon(Base): #: `AddonManager` self.manager = manager - #register events + # register events if self.event_map: for event, funcs in self.event_map.iteritems(): if type(funcs) in (list, tuple): for f in funcs: - self.manager.addEvent(event, getattr(self,f)) + self.manager.addEvent(event, getattr(self, f)) else: - self.manager.addEvent(event, getattr(self,funcs)) + self.manager.addEvent(event, getattr(self, funcs)) - #delete for various reasons + # delete for various reasons self.event_map = None if self.event_list: for f in self.event_list: - self.manager.addEvent(f, getattr(self,f)) + self.manager.addEvent(f, getattr(self, f)) self.event_list = None diff --git a/pyload/plugin/Hoster.py b/pyload/plugin/Hoster.py index df778c72f..64c635c45 100644 --- a/pyload/plugin/Hoster.py +++ b/pyload/plugin/Hoster.py @@ -4,7 +4,7 @@ from pyload.plugin.Plugin import Plugin def getInfo(self): - #result = [ .. (name, size, status, url) .. ] + # result = [ .. (name, size, status, url) .. ] return diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py index 54963447c..0604547a3 100644 --- a/pyload/plugin/Plugin.py +++ b/pyload/plugin/Plugin.py @@ -705,7 +705,7 @@ class Plugin(Base): content = f.read(read_size if read_size else -1) # produces encoding errors, better log to other file in the future? - #self.logDebug("Content: %s" % content) + # self.logDebug("Content: %s" % content) for name, rule in rules.iteritems(): if isinstance(rule, basestring): if rule in content: diff --git a/pyload/plugin/account/AlldebridCom.py b/pyload/plugin/account/AlldebridCom.py index e3eb01ac2..efc5753f8 100644 --- a/pyload/plugin/account/AlldebridCom.py +++ b/pyload/plugin/account/AlldebridCom.py @@ -24,7 +24,7 @@ class AlldebridCom(Account): html = req.load("http://www.alldebrid.com/account/") soup = BeautifulSoup(html) - #Try to parse expiration date directly from the control panel page (better accuracy) + # Try to parse expiration date directly from the control panel page (better accuracy) try: time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string @@ -35,7 +35,7 @@ class AlldebridCom(Account): exp_time = time.time() + int(exp_data[0]) * 24 * 60 * 60 + int( exp_data[1]) * 60 * 60 + (int(exp_data[2]) - 1) * 60 - #Get expiration date from API + # Get expiration date from API except Exception: data = self.getAccountData(user) html = req.load("http://www.alldebrid.com/api.php", diff --git a/pyload/plugin/account/FileserveCom.py b/pyload/plugin/account/FileserveCom.py index 46cb3cbad..d68285a33 100644 --- a/pyload/plugin/account/FileserveCom.py +++ b/pyload/plugin/account/FileserveCom.py @@ -38,7 +38,7 @@ class FileserveCom(Account): if not res['type']: self.wrongPassword() - #login at fileserv html + # login at fileserv html req.load("http://www.fileserve.com/login.php", post={"loginUserName": user, "loginUserPassword": data['password'], "autoLogin": "checked", "loginFormSubmit": "Login"}) diff --git a/pyload/plugin/account/HellshareCz.py b/pyload/plugin/account/HellshareCz.py index 444677c88..68843ee80 100644 --- a/pyload/plugin/account/HellshareCz.py +++ b/pyload/plugin/account/HellshareCz.py @@ -33,14 +33,14 @@ class HellshareCz(Account): premium = True try: if "." in credit: - #Time-based account + # Time-based account vt = [int(x) for x in credit.split('.')[:2]] lt = time.localtime() year = lt.tm_year + int(vt[1] < lt.tm_mon or (vt[1] == lt.tm_mon and vt[0] < lt.tm_mday)) validuntil = time.mktime(time.strptime("%s%d 23:59:59" % (credit, year), "%d.%m.%Y %H:%M:%S")) trafficleft = -1 else: - #Traffic-based account + # Traffic-based account trafficleft = self.parseTraffic(credit + "MB") validuntil = -1 except Exception, e: @@ -54,7 +54,7 @@ class HellshareCz(Account): def login(self, user, data, req): html = req.load('http://www.hellshare.com/', decode=True) if req.lastEffectiveURL != 'http://www.hellshare.com/': - #Switch to English + # Switch to English self.logDebug("Switch lang - URL: %s" % req.lastEffectiveURL) json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL) diff --git a/pyload/plugin/account/MegaRapidoNet.py b/pyload/plugin/account/MegaRapidoNet.py index 2bffff288..c4ee559da 100644 --- a/pyload/plugin/account/MegaRapidoNet.py +++ b/pyload/plugin/account/MegaRapidoNet.py @@ -29,7 +29,7 @@ class MegaRapidoNet(Account): validuntil = re.search(self.VALID_UNTIL_PATTERN, html) if validuntil: - #hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich)) + # hier weitermachen!!! (müssen umbedingt die zeit richtig machen damit! (sollte aber möglich)) validuntil = time.time() + int(validuntil.group(1)) * 24 * 3600 + int(validuntil.group(2)) * 3600 + int(validuntil.group(3)) * 60 + int(validuntil.group(4)) trafficleft = -1 premium = True diff --git a/pyload/plugin/account/MegasharesCom.py b/pyload/plugin/account/MegasharesCom.py index 593583a0e..8920bb2db 100644 --- a/pyload/plugin/account/MegasharesCom.py +++ b/pyload/plugin/account/MegasharesCom.py @@ -20,7 +20,7 @@ class MegasharesCom(Account): def loadAccountInfo(self, user, req): - #self.relogin(user) + # self.relogin(user) html = req.load("http://d01.megashares.com/myms.php", decode=True) premium = '>Premium Upgrade<' not in html diff --git a/pyload/plugin/account/MultishareCz.py b/pyload/plugin/account/MultishareCz.py index 6d41a2b18..66ab3dd47 100644 --- a/pyload/plugin/account/MultishareCz.py +++ b/pyload/plugin/account/MultishareCz.py @@ -20,7 +20,7 @@ class MultishareCz(Account): def loadAccountInfo(self, user, req): - #self.relogin(user) + # self.relogin(user) html = req.load("http://www.multishare.cz/profil/", decode=True) m = re.search(self.TRAFFIC_LEFT_PATTERN, html) diff --git a/pyload/plugin/account/RPNetBiz.py b/pyload/plugin/account/RPNetBiz.py index 2dfce536b..562436e85 100644 --- a/pyload/plugin/account/RPNetBiz.py +++ b/pyload/plugin/account/RPNetBiz.py @@ -26,7 +26,7 @@ class RPNetBiz(Account): account_info = {"validuntil": None, "trafficleft": None, "premium": False} except KeyError: - #handle wrong password exception + # handle wrong password exception account_info = {"validuntil": None, "trafficleft": None, "premium": False} return account_info diff --git a/pyload/plugin/account/YibaishiwuCom.py b/pyload/plugin/account/YibaishiwuCom.py index 0a15c29de..e12e3f3f2 100644 --- a/pyload/plugin/account/YibaishiwuCom.py +++ b/pyload/plugin/account/YibaishiwuCom.py @@ -19,7 +19,7 @@ class YibaishiwuCom(Account): def loadAccountInfo(self, user, req): - #self.relogin(user) + # self.relogin(user) html = req.load("http://115.com/", decode=True) m = re.search(self.ACCOUNT_INFO_PATTERN, html, re.S) diff --git a/pyload/plugin/addon/Checksum.py b/pyload/plugin/addon/Checksum.py index ed50b0f5e..750dd665e 100644 --- a/pyload/plugin/addon/Checksum.py +++ b/pyload/plugin/addon/Checksum.py @@ -105,8 +105,8 @@ class Checksum(Addon): self.checkFailed(pyfile, None, "No file downloaded") local_file = fs_encode(pyfile.plugin.lastDownload) - #download_folder = self.config.get("general", "download_folder") - #local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) + # download_folder = self.config.get("general", "download_folder") + # local_file = fs_encode(fs_join(download_folder, pyfile.package().folder, pyfile.name)) if not isfile(local_file): self.checkFailed(pyfile, None, "File does not exist") diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index a106d22ab..82938921e 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -9,7 +9,7 @@ import traceback from copy import copy # monkey patch bug in python 2.6 and lower -# http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 +# http://bugs.python.org/issue6122, http://bugs.python.org/issue1236, http://bugs.python.org/issue1731717 if sys.version_info < (2, 7) and os.name != "nt": import errno import subprocess diff --git a/pyload/plugin/addon/IRCInterface.py b/pyload/plugin/addon/IRCInterface.py index 73998b674..07a07e381 100644 --- a/pyload/plugin/addon/IRCInterface.py +++ b/pyload/plugin/addon/IRCInterface.py @@ -338,7 +338,7 @@ class IRCInterface(Thread, Addon): if not pack: return ["ERROR: Package doesn't exists."] - #TODO add links + # TODO add links return ["INFO: Added %d links to Package %s [#%d]" % (len(links), pack['name'], id)] diff --git a/pyload/plugin/addon/XMPPInterface.py b/pyload/plugin/addon/XMPPInterface.py index c977042e6..5ce5b5e8b 100644 --- a/pyload/plugin/addon/XMPPInterface.py +++ b/pyload/plugin/addon/XMPPInterface.py @@ -135,7 +135,7 @@ class XMPPInterface(IRCInterface, JabberClient): to_jid = stanza.get_from() from_jid = stanza.get_to() - #j = JID() + # j = JID() to_name = to_jid.as_utf8() from_name = from_jid.as_utf8() diff --git a/pyload/plugin/crypter/LinkCryptWs.py b/pyload/plugin/crypter/LinkCryptWs.py index 79a59889a..b26d6830d 100644 --- a/pyload/plugin/crypter/LinkCryptWs.py +++ b/pyload/plugin/crypter/LinkCryptWs.py @@ -74,7 +74,7 @@ class LinkCryptWs(Crypter): # Get package name and folder package_name, folder_name = self.getPackageInfo() - #get the container definitions from script section + # get the container definitions from script section self.get_container_html() # Extract package links diff --git a/pyload/plugin/crypter/MediafireCom.py b/pyload/plugin/crypter/MediafireCom.py index 479d1a70a..aae727a90 100644 --- a/pyload/plugin/crypter/MediafireCom.py +++ b/pyload/plugin/crypter/MediafireCom.py @@ -46,7 +46,7 @@ class MediafireCom(Crypter): get={'folder_key' : folder_key, 'response_format': "json", 'version' : 1})) - #self.logInfo(json_resp) + # self.logInfo(json_resp) if json_resp['response']['result'] == "Success": for link in json_resp['response']['folder_info']['files']: self.urls.append("http://www.mediafire.com/file/%s" % link['quickkey']) diff --git a/pyload/plugin/extractor/SevenZip.py b/pyload/plugin/extractor/SevenZip.py index 9d01965e0..3c5e86602 100644 --- a/pyload/plugin/extractor/SevenZip.py +++ b/pyload/plugin/extractor/SevenZip.py @@ -134,11 +134,11 @@ class SevenZip(UnRar): def call_cmd(self, command, *xargs, **kwargs): args = [] - #overwrite flag + # overwrite flag if self.overwrite: args.append("-y") - #set a password + # set a password if "password" in kwargs and kwargs['password']: args.append("-p%s" % kwargs['password']) else: diff --git a/pyload/plugin/hook/BypassCaptcha.py b/pyload/plugin/hook/BypassCaptcha.py index e3fae426e..554452776 100644 --- a/pyload/plugin/hook/BypassCaptcha.py +++ b/pyload/plugin/hook/BypassCaptcha.py @@ -57,7 +57,7 @@ class BypassCaptcha(Hook): def submit(self, captcha, captchaType="file", match=None): req = getRequest() - #raise timeout threshold + # raise timeout threshold req.c.setopt(LOW_SPEED_TIME, 80) try: diff --git a/pyload/plugin/hook/ExpertDecoders.py b/pyload/plugin/hook/ExpertDecoders.py index 2e2982d2d..843c786bc 100644 --- a/pyload/plugin/hook/ExpertDecoders.py +++ b/pyload/plugin/hook/ExpertDecoders.py @@ -54,7 +54,7 @@ class ExpertDecoders(Hook): data = f.read() req = getRequest() - #raise timeout threshold + # raise timeout threshold req.c.setopt(LOW_SPEED_TIME, 80) try: diff --git a/pyload/plugin/hook/ImageTyperz.py b/pyload/plugin/hook/ImageTyperz.py index 5dadc09f1..6c3c5c84b 100644 --- a/pyload/plugin/hook/ImageTyperz.py +++ b/pyload/plugin/hook/ImageTyperz.py @@ -69,7 +69,7 @@ class ImageTyperz(Hook): def submit(self, captcha, captchaType="file", match=None): req = getRequest() - #raise timeout threshold + # raise timeout threshold req.c.setopt(LOW_SPEED_TIME, 80) try: diff --git a/pyload/plugin/hook/XFileSharingPro.py b/pyload/plugin/hook/XFileSharingPro.py index 3c16c618a..7fee029da 100644 --- a/pyload/plugin/hook/XFileSharingPro.py +++ b/pyload/plugin/hook/XFileSharingPro.py @@ -32,11 +32,11 @@ class XFileSharingPro(Hook): "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in", "filevice.com", "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", "ryushare.com", "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", - #NOT TESTED: + # NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", "vidbull.com", "zalaa.com", "zomgupload.com", - #NOT WORKING: + # NOT WORKING: "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"] CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"] diff --git a/pyload/plugin/hoster/BezvadataCz.py b/pyload/plugin/hoster/BezvadataCz.py index 3eab28ae6..fa29c83d5 100644 --- a/pyload/plugin/hoster/BezvadataCz.py +++ b/pyload/plugin/hoster/BezvadataCz.py @@ -29,13 +29,13 @@ class BezvadataCz(SimpleHoster): def handleFree(self, pyfile): - #download button + # download button m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) if m is None: self.error(_("Page 1 URL not found")) url = "http://bezvadata.cz%s" % m.group(1) - #captcha form + # captcha form self.html = self.load(url) self.checkErrors() for _i in xrange(5): @@ -47,7 +47,7 @@ class BezvadataCz(SimpleHoster): if m is None: self.error(_("Wrong captcha image")) - #captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url + # captcha image is contained in html page as base64encoded data but decryptCaptcha() expects image url self.load, proper_load = self.loadcaptcha, self.load try: inputs['captcha'] = self.decryptCaptcha(m.group(1), imgtype='png') @@ -62,7 +62,7 @@ class BezvadataCz(SimpleHoster): else: self.fail(_("No valid captcha code entered")) - #download url + # download url self.html = self.load("http://bezvadata.cz%s" % action, post=inputs) self.checkErrors() m = re.search(r'<a class="stahnoutSoubor2" href="(.*?)">', self.html) @@ -71,7 +71,7 @@ class BezvadataCz(SimpleHoster): url = "http://bezvadata.cz%s" % m.group(1) self.logDebug("DL URL %s" % url) - #countdown + # countdown m = re.search(r'id="countdown">(\d\d):(\d\d)<', self.html) wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 120 self.wait(wait_time, False) diff --git a/pyload/plugin/hoster/DlFreeFr.py b/pyload/plugin/hoster/DlFreeFr.py index 151d0ca9f..684da2b6d 100644 --- a/pyload/plugin/hoster/DlFreeFr.py +++ b/pyload/plugin/hoster/DlFreeFr.py @@ -117,7 +117,7 @@ class DlFreeFr(SimpleHoster): def getLastHeaders(self): - #parse header + # parse header header = {"code": self.req.code} for line in self.req.http.header.splitlines(): line = line.strip() diff --git a/pyload/plugin/hoster/FilesMailRu.py b/pyload/plugin/hoster/FilesMailRu.py index 024da64cd..0d7f47536 100644 --- a/pyload/plugin/hoster/FilesMailRu.py +++ b/pyload/plugin/hoster/FilesMailRu.py @@ -49,17 +49,17 @@ class FilesMailRu(Hoster): self.html = self.load(pyfile.url) self.url_pattern = '<a href="(.+?)" onclick="return Act\(this\, \'dlink\'\, event\)">(.+?)</a>' - #marks the file as "offline" when the pattern was found on the html-page''' + # marks the file as "offline" when the pattern was found on the html-page''' if r'<div class="errorMessage mb10">' in self.html: self.offline() elif r'Page cannot be displayed' in self.html: self.offline() - #the filename that will be showed in the list (e.g. test.part1.rar)''' + # the filename that will be showed in the list (e.g. test.part1.rar)''' pyfile.name = self.getFileName() - #prepare and download''' + # prepare and download''' if not self.account: self.prepare() self.download(self.getFileUrl()) diff --git a/pyload/plugin/hoster/FileserveCom.py b/pyload/plugin/hoster/FileserveCom.py index a7bb22440..686bff101 100644 --- a/pyload/plugin/hoster/FileserveCom.py +++ b/pyload/plugin/hoster/FileserveCom.py @@ -185,7 +185,7 @@ class FileserveCom(Hoster): def handlePremium(self, pyfile): premium_url = None if self.__class__.__name__ == "FileserveCom": - #try api download + # try api download res = self.load("http://app.fileserve.com/api/download/premium/", post={"username": self.user, "password": self.account.getAccountData(self.user)['password'], diff --git a/pyload/plugin/hoster/FreakshareCom.py b/pyload/plugin/hoster/FreakshareCom.py index 64d8f8308..1b1d25826 100644 --- a/pyload/plugin/hoster/FreakshareCom.py +++ b/pyload/plugin/hoster/FreakshareCom.py @@ -98,8 +98,8 @@ class FreakshareCom(Hoster): self.download_html() if not self.wantReconnect: self.req_opts = self.get_download_options() # get the Post options for the Request - #file_url = self.pyfile.url - #return file_url + # file_url = self.pyfile.url + # return file_url else: self.offline() diff --git a/pyload/plugin/hoster/Ftp.py b/pyload/plugin/hoster/Ftp.py index 42ef3c357..4f6a01d22 100644 --- a/pyload/plugin/hoster/Ftp.py +++ b/pyload/plugin/hoster/Ftp.py @@ -64,7 +64,7 @@ class Ftp(Hoster): pyfile.size = int(m.group(1)) self.download(pyfile.url) else: - #Naive ftp directory listing + # Naive ftp directory listing if re.search(r'^25\d.*?"', self.req.http.header, re.M): pyfile.url = pyfile.url.rstrip('/') pkgname = "/".join(pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2]) diff --git a/pyload/plugin/hoster/NetloadIn.py b/pyload/plugin/hoster/NetloadIn.py index 51bc2a600..a3d0b44b1 100644 --- a/pyload/plugin/hoster/NetloadIn.py +++ b/pyload/plugin/hoster/NetloadIn.py @@ -120,7 +120,7 @@ class NetloadIn(Hoster): match = id_regex.search(url) if match: - #normalize url + # normalize url self.url = 'http://www.netload.in/datei%s.htm' % match.group('ID') self.logDebug("URL: %s" % self.url) else: diff --git a/pyload/plugin/hoster/PremiumTo.py b/pyload/plugin/hoster/PremiumTo.py index c7ee09565..750e965d2 100644 --- a/pyload/plugin/hoster/PremiumTo.py +++ b/pyload/plugin/hoster/PremiumTo.py @@ -27,7 +27,7 @@ class PremiumTo(MultiHoster): def handlePremium(self, pyfile): - #raise timeout to 2min + # raise timeout to 2min self.download("http://premium.to/api/getfile.php", get={'username': self.account.username, 'password': self.account.password, diff --git a/pyload/plugin/hoster/ShareplaceCom.py b/pyload/plugin/hoster/ShareplaceCom.py index 7d9630d20..08fb966b8 100644 --- a/pyload/plugin/hoster/ShareplaceCom.py +++ b/pyload/plugin/hoster/ShareplaceCom.py @@ -40,7 +40,7 @@ class ShareplaceCom(Hoster): if not self.html: self.download_html() - #var zzipitime = 15; + # var zzipitime = 15; m = re.search(r'var zzipitime = (\d+);', self.html) if m: sec = int(m.group(1)) diff --git a/pyload/plugin/hoster/SimplydebridCom.py b/pyload/plugin/hoster/SimplydebridCom.py index 2fa68b508..d703c3e52 100644 --- a/pyload/plugin/hoster/SimplydebridCom.py +++ b/pyload/plugin/hoster/SimplydebridCom.py @@ -19,7 +19,7 @@ class SimplydebridCom(MultiHoster): def handlePremium(self, pyfile): - #fix the links for simply-debrid.com! + # fix the links for simply-debrid.com! self.link = replace_patterns(pyfile.url, [("clz.to", "cloudzer.net/file") ("http://share-online", "http://www.share-online") ("ul.to", "uploaded.net/file") diff --git a/pyload/plugin/hoster/YourfilesTo.py b/pyload/plugin/hoster/YourfilesTo.py index a3d5e310c..f5e778741 100644 --- a/pyload/plugin/hoster/YourfilesTo.py +++ b/pyload/plugin/hoster/YourfilesTo.py @@ -41,7 +41,7 @@ class YourfilesTo(Hoster): if not self.html: self.download_html() - #var zzipitime = 15; + # var zzipitime = 15; m = re.search(r'var zzipitime = (\d+);', self.html) if m: sec = int(m.group(1)) diff --git a/pyload/plugin/hoster/YoutubeCom.py b/pyload/plugin/hoster/YoutubeCom.py index 14503be03..5db9957f8 100644 --- a/pyload/plugin/hoster/YoutubeCom.py +++ b/pyload/plugin/hoster/YoutubeCom.py @@ -94,7 +94,7 @@ class YoutubeCom(Hoster): if "We have been receiving a large volume of requests from your network." in html: self.tempOffline() - #get config + # get config use3d = self.getConfig('3d') if use3d: @@ -113,7 +113,7 @@ class YoutubeCom(Hoster): self.logWarning(_("FMT %d unknown, using default") % desired_fmt) desired_fmt = 0 - #parse available streams + # parse available streams streams = re.search(r'"url_encoded_fmt_stream_map":"(.+?)",', html).group(1) streams = [x.split('\u0026') for x in streams.split(',')] streams = [dict((y.split('=', 1)) for y in x) for x in streams] @@ -123,7 +123,7 @@ class YoutubeCom(Hoster): self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams]) - #build dictionary of supported itags (3D/2D) + # build dictionary of supported itags (3D/2D) allowed = lambda x: self.getConfig(self.formats[x][0]) streams = [x for x in streams if x[0] in self.formats and allowed(x[0])] @@ -136,11 +136,11 @@ class YoutubeCom(Hoster): (desired_fmt, "%s %dx%d Q:%d 3D:%s" % self.formats[desired_fmt], "" if desired_fmt in fmt_dict else "NOT ", "" if allowed(desired_fmt) else "NOT ")) - #return fmt nearest to quality index + # return fmt nearest to quality index if desired_fmt in fmt_dict and allowed(desired_fmt): fmt = desired_fmt else: - sel = lambda x: self.formats[x][3] # select quality index + sel = lambda x: self.formats[x][3] #: select quality index comp = lambda x, y: abs(sel(x) - sel(y)) self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()]) @@ -154,7 +154,7 @@ class YoutubeCom(Hoster): self.logDebug("URL: %s" % url) - #set file name + # set file name file_suffix = self.formats[fmt][0] if fmt in self.formats else ".flv" file_name_pattern = '<meta name="title" content="(.+?)">' name = re.search(file_name_pattern, html).group(1).replace("/", "") diff --git a/pyload/plugin/ocr/ShareonlineBiz.py b/pyload/plugin/ocr/ShareonlineBiz.py index b07653279..8efbdee35 100644 --- a/pyload/plugin/ocr/ShareonlineBiz.py +++ b/pyload/plugin/ocr/ShareonlineBiz.py @@ -23,8 +23,8 @@ class ShareonlineBiz(OCR): self.image = self.image.resize((160, 50)) self.pixels = self.image.load() self.threshold(1.85) - #self.eval_black_white(240) - #self.derotate_by_average() + # self.eval_black_white(240) + # self.derotate_by_average() letters = self.split_captcha_letters() @@ -36,4 +36,4 @@ class ShareonlineBiz(OCR): return final - #tesseract at 60% + # tesseract at 60% diff --git a/pyload/remote/thriftbackend/Socket.py b/pyload/remote/thriftbackend/Socket.py index 3d2435a92..0ca9ed178 100644 --- a/pyload/remote/thriftbackend/Socket.py +++ b/pyload/remote/thriftbackend/Socket.py @@ -68,7 +68,7 @@ class Socket(TSocket): else: self.handle = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - #errno 104 connection reset + # errno 104 connection reset self.handle.settimeout(self._timeout) self.handle.connect((self.host, self.port)) @@ -94,7 +94,7 @@ class Socket(TSocket): if e.args == (-1, 'Unexpected EOF'): buff = '' elif e.args == ([('SSL routines', 'SSL23_GET_CLIENT_HELLO', 'unknown protocol')],): - #a socket not using ssl tried to connect + # a socket not using ssl tried to connect buff = '' else: raise diff --git a/pyload/remote/thriftbackend/ThriftClient.py b/pyload/remote/thriftbackend/ThriftClient.py index 4f1c8dcc2..b018fbcc4 100644 --- a/pyload/remote/thriftbackend/ThriftClient.py +++ b/pyload/remote/thriftbackend/ThriftClient.py @@ -49,10 +49,10 @@ class ThriftClient(object): correct = self.client.login(user, password) except error, e: if e.args and e.args[0] == 104: - #connection reset by peer, probably wants ssl + # connection reset by peer, probably wants ssl try: self.createConnection(host, port, True) - #set timeout or a ssl socket will block when querying none ssl server + # set timeout or a ssl socket will block when querying none ssl server self.socket.setTimeout(10) except ImportError: diff --git a/pyload/remote/thriftbackend/ThriftTest.py b/pyload/remote/thriftbackend/ThriftTest.py index ed4557e2d..c95e060b8 100644 --- a/pyload/remote/thriftbackend/ThriftTest.py +++ b/pyload/remote/thriftbackend/ThriftTest.py @@ -74,8 +74,8 @@ try: bench(client.getServerVersion) bench(client.statusServer) bench(client.statusDownloads) - #bench(client.getQueue) - #bench(client.getCollector) + # bench(client.getQueue) + # bench(client.getCollector) print print client.getServerVersion() diff --git a/pyload/utils/packagetools.py b/pyload/utils/packagetools.py index 0ab68a869..8ed55d0f7 100644 --- a/pyload/utils/packagetools.py +++ b/pyload/utils/packagetools.py @@ -79,7 +79,7 @@ def parseNames(files): if len(split) > 1: name = split.pop(1) - #check if an already existing package may be ok for this file + # check if an already existing package may be ok for this file # found = False # for pack in packs: # if pack in file: diff --git a/pyload/webui/app/pyloadweb.py b/pyload/webui/app/pyloadweb.py index 3f2eff279..705895310 100644 --- a/pyload/webui/app/pyloadweb.py +++ b/pyload/webui/app/pyloadweb.py @@ -231,7 +231,7 @@ def downloads(): @login_required("DOWNLOAD") def get_download(path): path = unquote(path).decode("utf8") - # @TODO some files can not be downloaded + #@TODO some files can not be downloaded root = PYLOAD.getConfigValue("general", "download_folder") diff --git a/pyload/webui/servers/lighttpd_default.conf b/pyload/webui/servers/lighttpd_default.conf index 444ef39c5..9ccd264db 100644 --- a/pyload/webui/servers/lighttpd_default.conf +++ b/pyload/webui/servers/lighttpd_default.conf @@ -108,7 +108,7 @@ mimetype.assign = ( ) # Use the "Content-Type" extended attribute to obtain mime type if possible -#mimetype.use-xattr = "enable" +# mimetype.use-xattr = "enable" #### accesslog module accesslog.filename = "%(path)/access.log" @@ -125,7 +125,7 @@ server.pid-file = "%(path)/lighttpd.pid" server.bind = "%(host)" server.port = %(port) -#server.document-root = "/home/user/public_html" +# server.document-root = "/home/user/public_html" fastcgi.server = ( "/pyload.fcgi" => ( @@ -34,13 +34,13 @@ setup( platforms=['Any'], - #package_dir={'pyload': 'src'}, + # package_dir={'pyload': 'src'}, packages=['pyload'], - #package_data=find_package_data(), + # package_data=find_package_data(), - #data_files=[], + # data_files=[], include_package_data=True, @@ -74,11 +74,11 @@ setup( 'JSON speedup' : ["simplejson"] }, - #setup_requires=["setuptools_hg"], + # setup_requires=["setuptools_hg"], - #test_suite='nose.collector', + # test_suite='nose.collector', - #tests_require=['nose', 'websocket-client >= 0.8.0', 'requests >= 1.2.2'], + # tests_require=['nose', 'websocket-client >= 0.8.0', 'requests >= 1.2.2'], entry_points={ 'console_scripts': [ |