diff options
| author | 2015-04-20 22:56:34 +0200 | |
|---|---|---|
| committer | 2015-04-20 23:02:08 +0200 | |
| commit | 892b7cbd4981b764bed30b2ccc5ca73d791c39f2 (patch) | |
| tree | 1f5f142ad7e21de9e88f0c15957bbc7e03a9d1ff /pyload/plugin | |
| parent | Spare code cosmetics (8) (diff) | |
| download | pyload-892b7cbd4981b764bed30b2ccc5ca73d791c39f2.tar.xz | |
Spare code cosmetics (9)
Diffstat (limited to 'pyload/plugin')
25 files changed, 46 insertions, 46 deletions
diff --git a/pyload/plugin/Account.py b/pyload/plugin/Account.py index f025170b3..fda76a78f 100644 --- a/pyload/plugin/Account.py +++ b/pyload/plugin/Account.py @@ -96,7 +96,7 @@ class Account(Base):              req.cj.clear()              req.close()          if user in self.infos: -            del self.infos[user]  # delete old information +            del self.infos[user]  #: delete old information          return self._login(user, self.accounts[user]) @@ -112,7 +112,7 @@ class Account(Base):          """ updates account and return true if anything changed """          if user in self.accounts: -            self.accounts[user]['valid'] = True  # do not remove or accounts will not login +            self.accounts[user]['valid'] = True  #: do not remove or accounts will not login              if password:                  self.accounts[user]['password'] = password                  self.relogin(user) diff --git a/pyload/plugin/Addon.py b/pyload/plugin/Addon.py index 43de6732a..e8cc03de2 100644 --- a/pyload/plugin/Addon.py +++ b/pyload/plugin/Addon.py @@ -112,7 +112,7 @@ class Addon(Base):              self.unload() -    def unload(self):  # Deprecated, use method deactivate() instead +    def unload(self):  #: Deprecated, use method deactivate() instead          pass @@ -130,7 +130,7 @@ class Addon(Base):              self.coreReady() -    def coreReady(self):  # Deprecated, use method activate() instead +    def coreReady(self):  #: Deprecated, use method activate() instead          pass @@ -140,7 +140,7 @@ class Addon(Base):              self.coreExiting() -    def coreExiting(self):  # Deprecated, use method exit() instead +    def coreExiting(self):  #: Deprecated, use method exit() instead          pass diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py index 0604547a3..8b7e6fbc2 100644 --- a/pyload/plugin/Plugin.py +++ b/pyload/plugin/Plugin.py @@ -220,10 +220,10 @@ class Plugin(Base):              self.user, data = self.account.selectAccount()              #: Browser instance, see `network.Browser`              self.req = self.account.getAccountRequest(self.user) -            self.chunkLimit = -1  # chunk limit, -1 for unlimited +            self.chunkLimit = -1  #: chunk limit, -1 for unlimited              #: enables resume (will be ignored if server dont accept chunks)              self.resumeDownload = True -            self.multiDL = True  # every hoster with account should provide multiple downloads +            self.multiDL = True  #: every hoster with account should provide multiple downloads              #: premium status              self.premium = self.account.isPremium(self.user)          else: @@ -232,7 +232,7 @@ class Plugin(Base):          #: associated pyfile instance, see `PyFile`          self.pyfile = pyfile -        self.thread = None  # holds thread in future +        self.thread = None  #: holds thread in future          #: location where the last call to download was saved          self.lastDownload = "" @@ -500,7 +500,7 @@ class Plugin(Base):              captchaManager.removeTask(task) -            if task.error and has_plugin:  # ignore default error message since the user could use OCR +            if task.error and has_plugin:  #: ignore default error message since the user could use OCR                  self.fail(_("Pil and tesseract not installed and no Client connected for captcha decrypting"))              elif task.error:                  self.fail(task.error) @@ -740,9 +740,9 @@ class Plugin(Base):          for pyfile in self.core.files.cache.values():              if pyfile != self.pyfile and pyfile.name == self.pyfile.name and pyfile.package().folder == pack.folder: -                if pyfile.status in (0, 12):  # finished or downloading +                if pyfile.status in (0, 12):  #: finished or downloading                      raise SkipDownload(pyfile.pluginname) -                elif pyfile.status in (5, 7) and starting:  # a download is waiting/starting and was appenrently started before +                elif pyfile.status in (5, 7) and starting:  #: a download is waiting/starting and was appenrently started before                      raise SkipDownload(pyfile.pluginname)          download_folder = self.core.config.get("general", "download_folder") diff --git a/pyload/plugin/account/FastshareCz.py b/pyload/plugin/account/FastshareCz.py index 518746710..f1ed9d634 100644 --- a/pyload/plugin/account/FastshareCz.py +++ b/pyload/plugin/account/FastshareCz.py @@ -41,7 +41,7 @@ class FastshareCz(Account):      def login(self, user, data, req):          req.cj.setCookie("fastshare.cz", "lang", "en") -        req.load('http://www.fastshare.cz/login')  # Do not remove or it will not login +        req.load('http://www.fastshare.cz/login')  #: Do not remove or it will not login          html = req.load("http://www.fastshare.cz/sql.php",                          post={'login': user, 'heslo': data['password']}, diff --git a/pyload/plugin/account/FilecloudIo.py b/pyload/plugin/account/FilecloudIo.py index 12e2d44f5..b07fe981a 100644 --- a/pyload/plugin/account/FilecloudIo.py +++ b/pyload/plugin/account/FilecloudIo.py @@ -30,7 +30,7 @@ class FilecloudIo(Account):              return {"premium": False}          akey = rep['akey'] -        self.accounts[user]['akey'] = akey  # Saved for hoster plugin +        self.accounts[user]['akey'] = akey  #: Saved for hoster plugin          rep = req.load("http://api.filecloud.io/api-fetch_account_details.api",                         post={"akey": akey})          rep = json_loads(rep) diff --git a/pyload/plugin/crypter/DataHu.py b/pyload/plugin/crypter/DataHu.py index dd817b5ce..ce480dacb 100644 --- a/pyload/plugin/crypter/DataHu.py +++ b/pyload/plugin/crypter/DataHu.py @@ -28,7 +28,7 @@ class DataHu(SimpleCrypter):      def prepare(self):          super(DataHu, self).prepare() -        if u'K\xe9rlek add meg a jelsz\xf3t' in self.html:  # Password protected +        if u'K\xe9rlek add meg a jelsz\xf3t' in self.html:  #: Password protected              password = self.getPassword()              if not password:                  self.fail(_("Password required")) @@ -37,5 +37,5 @@ class DataHu(SimpleCrypter):              self.html = self.load(self.pyfile.url, post={'mappa_pass': password}, decode=True) -            if u'Hib\xe1s jelsz\xf3' in self.html:  # Wrong password +            if u'Hib\xe1s jelsz\xf3' in self.html:  #: Wrong password                  self.fail(_("Wrong password")) diff --git a/pyload/plugin/crypter/LinkCryptWs.py b/pyload/plugin/crypter/LinkCryptWs.py index b26d6830d..c997cbf9f 100644 --- a/pyload/plugin/crypter/LinkCryptWs.py +++ b/pyload/plugin/crypter/LinkCryptWs.py @@ -238,7 +238,7 @@ class LinkCryptWs(Crypter):          self.logDebug('Search for %s Container links' % type.upper()) -        if not type.isalnum():  # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric) +        if not type.isalnum():  #: check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric)              self.fail(_("Unknown container type: %s") % type)  #@TODO: Replace with self.error in 0.4.10          for line in self.container_html: diff --git a/pyload/plugin/crypter/NCryptIn.py b/pyload/plugin/crypter/NCryptIn.py index d59fbd6a9..bc9702f21 100644 --- a/pyload/plugin/crypter/NCryptIn.py +++ b/pyload/plugin/crypter/NCryptIn.py @@ -69,7 +69,7 @@ class NCryptIn(Crypter):              # Extract package links              for link_source_type in self.links_source_order:                  package_links.extend(self.handleLinkSource(link_source_type)) -                if package_links:  # use only first source which provides links +                if package_links:  #: use only first source which provides links                      break              package_links = set(package_links) diff --git a/pyload/plugin/crypter/RelinkUs.py b/pyload/plugin/crypter/RelinkUs.py index 6296e9f40..2b9a85401 100644 --- a/pyload/plugin/crypter/RelinkUs.py +++ b/pyload/plugin/crypter/RelinkUs.py @@ -89,7 +89,7 @@ class RelinkUs(Crypter):          package_links = []          for sources in self.PREFERRED_LINK_SOURCES:              package_links.extend(self.handleLinkSource(sources)) -            if package_links:  # use only first source which provides links +            if package_links:  #: use only first source which provides links                  break          package_links = set(package_links) diff --git a/pyload/plugin/crypter/YoutubeComFolder.py b/pyload/plugin/crypter/YoutubeComFolder.py index 84277207a..220c1dfbb 100644 --- a/pyload/plugin/crypter/YoutubeComFolder.py +++ b/pyload/plugin/crypter/YoutubeComFolder.py @@ -43,7 +43,7 @@ class YoutubeComFolder(Crypter):              return {"id": channel['id'],                      "title": channel['snippet']['title'],                      "relatedPlaylists": channel['contentDetails']['relatedPlaylists'], -                    "user": user}  # One lone channel for user? +                    "user": user}  #: One lone channel for user?      def getPlaylist(self, p_id): diff --git a/pyload/plugin/hook/MegaDebridEu.py b/pyload/plugin/hook/MegaDebridEu.py index a069cbcdd..41abce37b 100644 --- a/pyload/plugin/hook/MegaDebridEu.py +++ b/pyload/plugin/hook/MegaDebridEu.py @@ -28,6 +28,6 @@ class MegaDebridEu(MultiHook):              host_list = [element[0] for element in json_data['hosters']]          else:              self.logError(_("Unable to retrieve hoster list")) -            host_list = list() +            host_list = []          return host_list diff --git a/pyload/plugin/hoster/FileserveCom.py b/pyload/plugin/hoster/FileserveCom.py index 686bff101..4530f8ff8 100644 --- a/pyload/plugin/hoster/FileserveCom.py +++ b/pyload/plugin/hoster/FileserveCom.py @@ -134,7 +134,7 @@ class FileserveCom(Hoster):              self.wait()              self.retry() -        self.thread.m.reconnecting.wait(3)  # Ease issue with later downloads appearing to be in parallel +        self.thread.m.reconnecting.wait(3)  #: Ease issue with later downloads appearing to be in parallel      def doTimmer(self): diff --git a/pyload/plugin/hoster/FreakshareCom.py b/pyload/plugin/hoster/FreakshareCom.py index 1b1d25826..6cf447128 100644 --- a/pyload/plugin/hoster/FreakshareCom.py +++ b/pyload/plugin/hoster/FreakshareCom.py @@ -87,7 +87,7 @@ class FreakshareCom(Hoster):      def download_html(self): -        self.load("http://freakshare.com/index.php", {"language": "EN"})  # Set english language in server session +        self.load("http://freakshare.com/index.php", {"language": "EN"})  #: Set english language in server session          self.html = self.load(self.pyfile.url) @@ -97,7 +97,7 @@ class FreakshareCom(Hoster):          if not self.html:              self.download_html()          if not self.wantReconnect: -            self.req_opts = self.get_download_options()  # get the Post options for the Request +            self.req_opts = self.get_download_options()  #: get the Post options for the Request              # file_url = self.pyfile.url              # return file_url          else: @@ -163,11 +163,11 @@ class FreakshareCom(Hoster):      def get_download_options(self):          re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>", -                                self.html).group(0)  # get the whole request +                                self.html).group(0)  #: get the whole request          to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope)          request_options = dict((n, v) for (v, n) in to_sort) -        herewego = self.load(self.pyfile.url, None, request_options)  # the actual download-Page +        herewego = self.load(self.pyfile.url, None, request_options)  #: the actual download-Page          to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego)          request_options = dict((n, v) for (v, n) in to_sort) diff --git a/pyload/plugin/hoster/Ftp.py b/pyload/plugin/hoster/Ftp.py index 4f6a01d22..86049df04 100644 --- a/pyload/plugin/hoster/Ftp.py +++ b/pyload/plugin/hoster/Ftp.py @@ -69,7 +69,7 @@ class Ftp(Hoster):                  pyfile.url = pyfile.url.rstrip('/')                  pkgname = "/".join(pyfile.package().name, urlparse(pyfile.url).path.rpartition('/')[2])                  pyfile.url += '/' -                self.req.http.c.setopt(48, 1)  # CURLOPT_DIRLISTONLY +                self.req.http.c.setopt(48, 1)  #: CURLOPT_DIRLISTONLY                  res = self.load(pyfile.url, decode=False)                  links = [pyfile.url + quote(x) for x in res.splitlines()]                  self.logDebug("LINKS", links) diff --git a/pyload/plugin/hoster/MegaCoNz.py b/pyload/plugin/hoster/MegaCoNz.py index 496d4503f..9dea99b23 100644 --- a/pyload/plugin/hoster/MegaCoNz.py +++ b/pyload/plugin/hoster/MegaCoNz.py @@ -126,8 +126,8 @@ class MegaCoNz(Hoster):          except IOError, e:              self.fail(e) -        chunk_size = 2 ** 15  # buffer size, 32k -        # file_mac   = [0, 0, 0, 0]  # calculate CBC-MAC for checksum +        chunk_size = 2 ** 15  #: buffer size, 32k +        # file_mac   = [0, 0, 0, 0]  #: calculate CBC-MAC for checksum          chunks = os.path.getsize(file_crypted) / chunk_size + 1          for i in xrange(chunks): diff --git a/pyload/plugin/hoster/NetloadIn.py b/pyload/plugin/hoster/NetloadIn.py index a3d0b44b1..f4421615f 100644 --- a/pyload/plugin/hoster/NetloadIn.py +++ b/pyload/plugin/hoster/NetloadIn.py @@ -152,9 +152,9 @@ class NetloadIn(Hoster):              if self.api_data['status'] == "online":                  self.api_data['checksum'] = lines[4].strip()              else: -                self.api_data = False  # check manually since api data is useless sometimes +                self.api_data = False  #: check manually since api data is useless sometimes -            if lines[0] == lines[1] and lines[2] == "0":  # useless api data +            if lines[0] == lines[1] and lines[2] == "0":  #: useless api data                  self.api_data = False          else:              self.api_data = False diff --git a/pyload/plugin/hoster/OboomCom.py b/pyload/plugin/hoster/OboomCom.py index c37e89339..5b9b11485 100644 --- a/pyload/plugin/hoster/OboomCom.py +++ b/pyload/plugin/hoster/OboomCom.py @@ -99,7 +99,7 @@ class OboomCom(Hoster):                      self.retry(5, 15 * 60, _("Service unavailable"))              elif result[0] == 403: -                if result[1] == -1:  # another download is running +                if result[1] == -1:  #: another download is running                      self.setWait(15 * 60)                  else:                      self.setWait(result[1], True) diff --git a/pyload/plugin/hoster/PornhostCom.py b/pyload/plugin/hoster/PornhostCom.py index f6a63117c..103882166 100644 --- a/pyload/plugin/hoster/PornhostCom.py +++ b/pyload/plugin/hoster/PornhostCom.py @@ -47,7 +47,7 @@ class PornhostCom(Hoster):                  url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html)                  if url is None:                      url = re.search(r'"http://file\d+\.pornhost\.com/\d+/.*?"', -                                    self.html)  # TODO: fix this one since it doesn't match +                                    self.html)  #: TODO: fix this one since it doesn't match          return url.group(1).strip() diff --git a/pyload/plugin/hoster/PremiumizeMe.py b/pyload/plugin/hoster/PremiumizeMe.py index 809d27624..f577da90e 100644 --- a/pyload/plugin/hoster/PremiumizeMe.py +++ b/pyload/plugin/hoster/PremiumizeMe.py @@ -20,7 +20,7 @@ class PremiumizeMe(MultiHoster):      def handlePremium(self, pyfile):          # In some cases hostsers do not supply us with a filename at download, so we          # are going to set a fall back filename (e.g. for freakshare or xfileshare) -        pyfile.name = pyfile.name.split('/').pop()  # Remove everthing before last slash +        pyfile.name = pyfile.name.split('/').pop()  #: Remove everthing before last slash          # Correction for automatic assigned filename: Removing html at end if needed          suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] diff --git a/pyload/plugin/hoster/RPNetBiz.py b/pyload/plugin/hoster/RPNetBiz.py index 6788eebce..dc11eefb2 100644 --- a/pyload/plugin/hoster/RPNetBiz.py +++ b/pyload/plugin/hoster/RPNetBiz.py @@ -34,12 +34,12 @@ class RPNetBiz(MultiHoster):                               "links"   : pyfile.url})          self.logDebug("JSON data: %s" % res) -        link_status = json_loads(res)['links'][0]  # get the first link... since we only queried one +        link_status = json_loads(res)['links'][0]  #: get the first link... since we only queried one          # Check if we only have an id as a HDD link          if 'id' in link_status:              self.logDebug("Need to wait at least 30 seconds before requery") -            self.setWait(30)  # wait for 30 seconds +            self.setWait(30)  #: wait for 30 seconds              self.wait()              # Lets query the server again asking for the status on the link,              # we need to keep doing this until we reach 100 @@ -66,7 +66,7 @@ class RPNetBiz(MultiHoster):                  self.wait()                  my_try += 1 -            if my_try > max_tries:  # We went over the limit! +            if my_try > max_tries:  #: We went over the limit!                  self.fail(_("Waited for about 15 minutes for download to finish but failed"))          if 'generated' in link_status: diff --git a/pyload/plugin/hoster/SmoozedCom.py b/pyload/plugin/hoster/SmoozedCom.py index 1ed3a539d..f216a95bc 100644 --- a/pyload/plugin/hoster/SmoozedCom.py +++ b/pyload/plugin/hoster/SmoozedCom.py @@ -20,7 +20,7 @@ class SmoozedCom(MultiHoster):      def handlePremium(self, pyfile):          # In some cases hostsers do not supply us with a filename at download, so we          # are going to set a fall back filename (e.g. for freakshare or xfileshare) -        pyfile.name = pyfile.name.split('/').pop()  # Remove everthing before last slash +        pyfile.name = pyfile.name.split('/').pop()  #: Remove everthing before last slash          # Correction for automatic assigned filename: Removing html at end if needed          suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] diff --git a/pyload/plugin/hoster/UlozTo.py b/pyload/plugin/hoster/UlozTo.py index b2e31dccf..49d5d2ac1 100644 --- a/pyload/plugin/hoster/UlozTo.py +++ b/pyload/plugin/hoster/UlozTo.py @@ -123,7 +123,7 @@ class UlozTo(SimpleHoster):              "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'),              "offline"      : re.compile(self.OFFLINE_PATTERN),              "passwd"       : self.PASSWD_PATTERN, -            "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"',  # paralell dl, server overload etc. +            "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"',  #: paralell dl, server overload etc.              "not_found"    : "<title>Ulož.to</title>"          }) diff --git a/pyload/plugin/hoster/UploadedTo.py b/pyload/plugin/hoster/UploadedTo.py index 487c01576..c8b201ec6 100644 --- a/pyload/plugin/hoster/UploadedTo.py +++ b/pyload/plugin/hoster/UploadedTo.py @@ -57,7 +57,7 @@ class UploadedTo(SimpleHoster):      def setup(self):          self.multiDL    = self.resumeDownload = self.premium -        self.chunkLimit = 1  # critical problems with more chunks +        self.chunkLimit = 1  #: critical problems with more chunks      def checkErrors(self): @@ -68,14 +68,14 @@ class UploadedTo(SimpleHoster):          elif "limit-size" in self.html:              self.fail(_("File too big for free download")) -        elif "limit-slot" in self.html:  # Temporary restriction so just wait a bit +        elif "limit-slot" in self.html:  #: Temporary restriction so just wait a bit              self.wait(30 * 60, True)              self.retry()          elif "limit-parallel" in self.html:              self.fail(_("Cannot download in parallel")) -        elif "limit-dl" in self.html or self.DL_LIMIT_ERROR in self.html:  # limit-dl +        elif "limit-dl" in self.html or self.DL_LIMIT_ERROR in self.html:  #: limit-dl              self.wait(3 * 60 * 60, True)              self.retry() diff --git a/pyload/plugin/hoster/Xdcc.py b/pyload/plugin/hoster/Xdcc.py index 42491404f..e1a4c72b2 100644 --- a/pyload/plugin/hoster/Xdcc.py +++ b/pyload/plugin/hoster/Xdcc.py @@ -29,7 +29,7 @@ class Xdcc(Hoster):      def setup(self): -        self.debug = 0  # 0,1,2 +        self.debug = 0  #: 0,1,2          self.timeout = 30          self.multiDL = False @@ -62,7 +62,7 @@ class Xdcc(Hoster):      def doDownload(self, url): -        self.pyfile.setStatus("waiting")  # real link +        self.pyfile.setStatus("waiting")  #: real link          m = re.match(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url)          server = m.group(1) @@ -89,7 +89,7 @@ class Xdcc(Hoster):          sock = socket.socket()          sock.connect((host, int(port)))          if nick == "pyload": -            nick = "pyload-%d" % (time.time() % 1000)  # last 3 digits +            nick = "pyload-%d" % (time.time() % 1000)  #: last 3 digits          sock.send("NICK %s\r\n" % nick)          sock.send("USER %s %s bla :%s\r\n" % (ident, host, real)) @@ -161,7 +161,7 @@ class Xdcc(Hoster):                          self.logDebug("Sending CTCP TIME")                          sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))                      elif msg['text'] == "\x01LAG\x01": -                        pass  # don't know how to answer +                        pass  #: don't know how to answer                  if not (bot == msg['origin'][0:len(bot)]                          and nick == msg['target'][0:len(nick)] diff --git a/pyload/plugin/hoster/ZippyshareCom.py b/pyload/plugin/hoster/ZippyshareCom.py index dd78071c9..7f91c04e5 100644 --- a/pyload/plugin/hoster/ZippyshareCom.py +++ b/pyload/plugin/hoster/ZippyshareCom.py @@ -68,7 +68,7 @@ class ZippyshareCom(SimpleHoster):          def replElementById(element):              id   = element.group(1)  #: id might be either 'x' (a real id) or x (a variable) -            attr = element.group(4)  # attr might be None +            attr = element.group(4)  #: attr might be None              varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr))  | 
