diff options
author | Stefano <l.stickell@yahoo.it> | 2013-07-25 21:01:35 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-07-25 21:04:59 +0200 |
commit | f93b21c2c31069ef11394cb696905ddd6ae43aa7 (patch) | |
tree | ae3ad86d7af7ecaddca089622988b0855cca369e | |
parent | Removed bad character (diff) | |
download | pyload-f93b21c2c31069ef11394cb696905ddd6ae43aa7.tar.xz |
Fixed some pylint violations
(cherry picked from commit cfbdcc19337314c0bc8901711ec0e63147e1c3d0)
-rw-r--r-- | pyload/plugins/addons/XMPPInterface.py | 4 | ||||
-rw-r--r-- | pyload/plugins/crypter/LinkSaveIn.py | 2 | ||||
-rw-r--r-- | pyload/plugins/crypter/SecuredIn.py | 12 | ||||
-rw-r--r-- | pyload/plugins/crypter/SerienjunkiesOrg.py | 20 | ||||
-rw-r--r-- | pyload/plugins/crypter/ShareLinksBiz.py | 26 | ||||
-rw-r--r-- | pyload/plugins/hoster/MegasharesCom.py | 10 | ||||
-rw-r--r-- | pyload/plugins/hoster/XFileSharingPro.py | 10 |
7 files changed, 41 insertions, 43 deletions
diff --git a/pyload/plugins/addons/XMPPInterface.py b/pyload/plugins/addons/XMPPInterface.py index 3edb3bcc0..a94f2ed05 100644 --- a/pyload/plugins/addons/XMPPInterface.py +++ b/pyload/plugins/addons/XMPPInterface.py @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - + @author: RaNaN @interface-version: 0.2 """ @@ -231,7 +231,7 @@ class XMPPInterface(IRCInterface, JabberClient): class VersionHandler(object): """Provides handler for a version query. - + This class will answer version query and announce 'jabber:iq:version' namespace in the client's disco#info results.""" diff --git a/pyload/plugins/crypter/LinkSaveIn.py b/pyload/plugins/crypter/LinkSaveIn.py index a73b7cc19..129da6608 100644 --- a/pyload/plugins/crypter/LinkSaveIn.py +++ b/pyload/plugins/crypter/LinkSaveIn.py @@ -48,7 +48,7 @@ class LinkSaveIn(Crypter): if not self.isOnline(): self.offline() - # Check for protection + # Check for protection if self.isPasswordProtected(): self.unlockPasswordProtection() self.handleErrors() diff --git a/pyload/plugins/crypter/SecuredIn.py b/pyload/plugins/crypter/SecuredIn.py index 7c0b27c8b..9bce390ac 100644 --- a/pyload/plugins/crypter/SecuredIn.py +++ b/pyload/plugins/crypter/SecuredIn.py @@ -11,7 +11,7 @@ class SecuredIn(Crypter): __name__ = "SecuredIn" __type__ = "container" __pattern__ = r"http://[\w\.]*?secured\.in/download-[\d]+-[\w]{8}\.html" - __version__ = "0.1" + __version__ = "0.2" __description__ = """secured.in Container Plugin""" __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") @@ -31,7 +31,7 @@ class SecuredIn(Crypter): src = self.req.load(url, cookies=True) soup = BeautifulSoup(src) img = soup.find("img", attrs={"id": "captcha_img"}) - for i in range(3): + for _ in range(3): form = soup.find("form", attrs={"id": "frm_captcha"}) captchaHash = form.find("input", attrs={"id": "captcha_hash"})["value"] captchaUrl = "http://secured.in/%s" % img["src"] @@ -41,8 +41,8 @@ class SecuredIn(Crypter): soup = BeautifulSoup(src) img = soup.find("img", attrs={"id": "captcha_img"}) if not img: - files = soup.findAll("tr", attrs={"id": re.compile("file-\d+")}) - dlIDPattern = re.compile("accessDownload\(\d, \d+, '(.*?)', \d\)") + files = soup.findAll("tr", attrs={"id": re.compile(r"file-\d+")}) + dlIDPattern = re.compile(r"accessDownload\(\d, \d+, '(.*?)', \d\)") cypher = self.Cypher() for cfile in files: m = dlIDPattern.search(cfile["onclick"]) @@ -396,13 +396,13 @@ class SecuredIn(Crypter): self.pqmyzkid = self.thdlpsmy self.pldmjnde = self.plkodnyq - yaqpolft = [0 for i in range(len(kaiumylq))] + yaqpolft = [0] * len(kaiumylq) yaqwsedr = 0 btzqwsay = 0 while yaqwsedr < len(kaiumylq): wlqoakmy = 0 - for lopiuztr in range(0, 4): + for _ in range(0, 4): wlqoakmy = wlqoakmy << 8 | ord(kaiumylq[yaqwsedr % len(kaiumylq)]) yaqwsedr += 1 yaqpolft[btzqwsay] = wlqoakmy diff --git a/pyload/plugins/crypter/SerienjunkiesOrg.py b/pyload/plugins/crypter/SerienjunkiesOrg.py index 95c6c5f5f..a682a44fa 100644 --- a/pyload/plugins/crypter/SerienjunkiesOrg.py +++ b/pyload/plugins/crypter/SerienjunkiesOrg.py @@ -14,13 +14,13 @@ class SerienjunkiesOrg(Crypter): __name__ = "SerienjunkiesOrg" __type__ = "container" __pattern__ = r"http://.*?(serienjunkies.org|dokujunkies.org)/.*?" - __version__ = "0.38" + __version__ = "0.39" __config__ = [ ("changeNameSJ", "Packagename;Show;Season;Format;Episode", "Take SJ.org name", "Show"), ("changeNameDJ", "Packagename;Show;Format;Episode", "Take DJ.org name", "Show"), ("randomPreferred", "bool", "Randomize Preferred-List", False), - ( - "hosterListMode", "OnlyOne;OnlyPreferred(One);OnlyPreferred(All);All", "Use for hosters (if supported)", "All"), + ("hosterListMode", "OnlyOne;OnlyPreferred(One);OnlyPreferred(All);All", + "Use for hosters (if supported)", "All"), ("hosterList", "str", "Preferred Hoster list (comma separated)", "RapidshareCom,UploadedTo,NetloadIn,FilefactoryCom,FreakshareNet,FilebaseTo,HotfileCom,DepositfilesCom,EasyshareCom,KickloadCom"), ("ignoreList", "str", "Ignored Hoster list (comma separated)", "MegauploadCom") @@ -29,7 +29,6 @@ class SerienjunkiesOrg(Crypter): __author_name__ = ("mkaay", "godofdream") __author_mail__ = ("mkaay@mkaay.de", "soilfiction@gmail.com") - def setup(self): self.multiDL = False @@ -64,7 +63,6 @@ class SerienjunkiesOrg(Crypter): else: self.core.files.addLinks(package_links, self.pyfile.package().id) - def handleSeason(self, url): src = self.getSJSrc(url) soup = BeautifulSoup(src) @@ -101,7 +99,7 @@ class SerienjunkiesOrg(Crypter): groups[gid]["ep"][ename] = {} parts.remove(parts[0]) for part in parts: - hostername = re.search(" \| ([-a-zA-Z0-9]+\.\w+)", part) + hostername = re.search(r" \| ([-a-zA-Z0-9]+\.\w+)", part) if hostername: hostername = hostername.group(1) groups[gid]["ep"][ename][hostername] = [] @@ -231,7 +229,7 @@ class SerienjunkiesOrg(Crypter): groups[gid]["ep"][ename] = {} parts.remove(parts[0]) for part in parts: - hostername = re.search(" \| ([-a-zA-Z0-9]+\.\w+)", part) + hostername = re.search(r" \| ([-a-zA-Z0-9]+\.\w+)", part) if hostername: hostername = hostername.group(1) groups[gid]["ep"][ename][hostername] = [] @@ -270,7 +268,7 @@ class SerienjunkiesOrg(Crypter): episodePattern = re.compile("^http://download.serienjunkies.org/f-.*?.html(#hasName)?$") oldStyleLink = re.compile("^http://serienjunkies.org/safe/(.*)$") categoryPatternDJ = re.compile("^http://dokujunkies.org/.*?(.*)$") - showPatternDJ = re.compile("^http://dokujunkies.org/.*?/(.*)\.html(#hasName)?$") + showPatternDJ = re.compile(r"^http://dokujunkies.org/.*?/(.*)\.html(#hasName)?$") framePattern = re.compile("^http://download.(serienjunkies.org|dokujunkies.org)/frame/go-.*?/$") url = pyfile.url if framePattern.match(url): @@ -293,8 +291,8 @@ class SerienjunkiesOrg(Crypter): result = [] preferredList = self.getConfig("hosterList").strip().lower().replace( - '|', ',').replace('.', '').replace(';', ',').split( ',') - if (self.getConfig("randomPreferred") == True) and ( + '|', ',').replace('.', '').replace(';', ',').split(',') + if (self.getConfig("randomPreferred") is True) and ( self.getConfig("hosterListMode") in ["OnlyOne", "OnlyPreferred(One)"]): random.shuffle(preferredList) # we don't want hosters be read two times @@ -311,7 +309,7 @@ class SerienjunkiesOrg(Crypter): return result ignorelist = self.getConfig("ignoreList").strip().lower().replace( - '|', ',').replace('.', '').replace(';', ',').split( ',') + '|', ',').replace('.', '').replace(';', ',').split(',') if self.getConfig('hosterListMode') in ["OnlyOne", "All"]: for Hoster in hosterlist2: if Hoster.strip().lower().replace('.', '') not in ignorelist: diff --git a/pyload/plugins/crypter/ShareLinksBiz.py b/pyload/plugins/crypter/ShareLinksBiz.py index 252766811..09ac21873 100644 --- a/pyload/plugins/crypter/ShareLinksBiz.py +++ b/pyload/plugins/crypter/ShareLinksBiz.py @@ -12,7 +12,7 @@ class ShareLinksBiz(Crypter): __name__ = "ShareLinksBiz" __type__ = "crypter" __pattern__ = r"(?P<base>http://[\w\.]*?(share-links|s2l)\.biz)/(?P<id>_?[0-9a-z]+)(/.*)?" - __version__ = "1.12" + __version__ = "1.13" __description__ = """Share-Links.biz Crypter""" __author_name__ = ("fragonib") __author_mail__ = ("fragonib[AT]yahoo[DOT]es") @@ -36,7 +36,7 @@ class ShareLinksBiz(Crypter): # Unblock server (load all images) self.unblockServer() - # Check for protection + # Check for protection if self.isPasswordProtected(): self.unlockPasswordProtection() self.handleErrors() @@ -53,7 +53,7 @@ class ShareLinksBiz(Crypter): package_links.extend(self.handleCNL2()) package_links = set(package_links) - # Get package info + # Get package info package_name, package_folder = self.getPackageInfo() # Pack @@ -86,7 +86,7 @@ class ShareLinksBiz(Crypter): return False def unblockServer(self): - imgs = re.findall("(/template/images/.*?\.gif)", self.html) + imgs = re.findall(r"(/template/images/.*?\.gif)", self.html) for img in imgs: self.load(self.baseUrl + img) @@ -121,12 +121,12 @@ class ShareLinksBiz(Crypter): self.html = self.load(url, decode=True) def _getCaptchaMap(self): - map = {} + mapp = {} for m in re.finditer(r'<area shape="rect" coords="(.*?)" href="(.*?)"', self.html): rect = eval('(' + m.group(1) + ')') href = m.group(2) - map[rect] = href - return map + mapp[rect] = href + return mapp def _resolveCoords(self, coords, captchaMap): x, y = coords @@ -168,21 +168,21 @@ class ShareLinksBiz(Crypter): folder = self.package.folder self.logDebug("Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder)) - # Return package info + # Return package info return name, folder def handleWebLinks(self): package_links = [] self.logDebug("Handling Web links") - #@TODO: Gather paginated web links + #@TODO: Gather paginated web links pattern = r"javascript:_get\('(.*?)', \d+, ''\)" ids = re.findall(pattern, self.html) self.logDebug("Decrypting %d Web links" % len(ids)) - for i, id in enumerate(ids): + for i, ID in enumerate(ids): try: - self.logDebug("Decrypting Web link %d, [%s]" % (i + 1, id)) - dwLink = self.baseUrl + "/get/lnk/" + id + self.logDebug("Decrypting Web link %d, [%s]" % (i + 1, ID)) + dwLink = self.baseUrl + "/get/lnk/" + ID response = self.load(dwLink) code = re.search(r'frm/(\d+)', response).group(1) fwLink = self.baseUrl + "/get/frm/" + code @@ -195,7 +195,7 @@ class ShareLinksBiz(Crypter): self.logDebug("JsEngine returns value [%s] for redirection link" % dlLink) package_links.append(dlLink) except Exception, detail: - self.logDebug("Error decrypting Web link [%s], %s" % (id, detail)) + self.logDebug("Error decrypting Web link [%s], %s" % (ID, detail)) return package_links def handleContainers(self): diff --git a/pyload/plugins/hoster/MegasharesCom.py b/pyload/plugins/hoster/MegasharesCom.py index 7021e69c0..3a66f356a 100644 --- a/pyload/plugins/hoster/MegasharesCom.py +++ b/pyload/plugins/hoster/MegasharesCom.py @@ -25,16 +25,16 @@ class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" __pattern__ = r"http://(\w+\.)?megashares.com/.*" - __version__ = "0.21" + __version__ = "0.22" __description__ = """megashares.com plugin - free only""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") FILE_NAME_PATTERN = '<h1 class="black xxl"[^>]*title="(?P<N>[^"]+)">' FILE_SIZE_PATTERN = '<strong><span class="black">Filesize:</span></strong> (?P<S>[0-9.]+) (?P<U>[kKMG])i?B<br />' - DOWNLOAD_URL_PATTERN = '<div id="show_download_button_%d"[^>]*>\s*<a href="([^"]+)">' - PASSPORT_LEFT_PATTERN = 'Your Download Passport is: <[^>]*>(\w+).*\s*You have\s*<[^>]*>\s*([0-9.]+) ([kKMG]i?B)' - PASSPORT_RENEW_PATTERN = 'Your download passport will renew in\s*<strong>(\d+)</strong>:<strong>(\d+)</strong>:<strong>(\d+)</strong>' + DOWNLOAD_URL_PATTERN = r'<div id="show_download_button_%d"[^>]*>\s*<a href="([^"]+)">' + PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*\s*You have\s*<[^>]*>\s*([0-9.]+) ([kKMG]i?B)' + PASSPORT_RENEW_PATTERN = r'Your download passport will renew in\s*<strong>(\d+)</strong>:<strong>(\d+)</strong>:<strong>(\d+)</strong>' REACTIVATE_NUM_PATTERN = r'<input[^>]*id="random_num" value="(\d+)" />' REACTIVATE_PASSPORT_PATTERN = r'<input[^>]*id="passport_num" value="(\w+)" />' REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' @@ -63,7 +63,7 @@ class MegasharesCom(SimpleHoster): passport_num = found.group(1) request_uri = re.search(self.REQUEST_URI_PATTERN, self.html).group(1) - for i in range(5): + for _ in range(5): random_num = re.search(self.REACTIVATE_NUM_PATTERN, self.html).group(1) verifyinput = self.decryptCaptcha( diff --git a/pyload/plugins/hoster/XFileSharingPro.py b/pyload/plugins/hoster/XFileSharingPro.py index 8885ba9ca..9df843678 100644 --- a/pyload/plugins/hoster/XFileSharingPro.py +++ b/pyload/plugins/hoster/XFileSharingPro.py @@ -112,7 +112,7 @@ class XFileSharingPro(SimpleHoster): self.req.http.c.setopt(FOLLOWLOCATION, 1) location = None - found = re.search("Location\s*:\s*(.*)", self.header, re.I) + found = re.search(r"Location\s*:\s*(.*)", self.header, re.I) if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)): location = found.group(1).strip() @@ -133,7 +133,7 @@ class XFileSharingPro(SimpleHoster): self.header = self.req.http.header self.req.http.c.setopt(FOLLOWLOCATION, 1) - found = re.search("Location\s*:\s*(.*)", self.header, re.I) + found = re.search(r"Location\s*:\s*(.*)", self.header, re.I) if found: break @@ -208,7 +208,7 @@ class XFileSharingPro(SimpleHoster): if 'wait' in self.errmsg: wait_time = sum([int(v) * {"hour": 3600, "minute": 60, "second": 1}[u] for v, u in - re.findall('(\d+)\s*(hour|minute|second)?', self.errmsg)]) + re.findall(r'(\d+)\s*(hour|minute|second)?', self.errmsg)]) self.setWait(wait_time, True) self.wait() elif 'captcha' in self.errmsg: @@ -234,7 +234,7 @@ class XFileSharingPro(SimpleHoster): return self.errmsg def getPostParameters(self): - for i in range(3): + for _ in range(3): if not self.errmsg: self.checkErrors() @@ -313,7 +313,7 @@ class XFileSharingPro(SimpleHoster): if found: captcha_div = found.group(1) self.logDebug(captcha_div) - numerals = re.findall('<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) + numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))]) self.logDebug("CAPTCHA", inputs['code'], numerals) return 3 |