From 0c525f750dad3f57297836ddea02da7d42ad5969 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 12 May 2015 17:21:33 +0200 Subject: Other import fixes (4) --- pyload/plugin/Plugin.py | 16 ++++++++-------- pyload/plugin/account/OboomCom.py | 4 ++-- pyload/plugin/account/SmoozedCom.py | 4 ++-- pyload/plugin/addon/ExtractArchive.py | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'pyload/plugin') diff --git a/pyload/plugin/Plugin.py b/pyload/plugin/Plugin.py index 6648c574f..1657ee529 100644 --- a/pyload/plugin/Plugin.py +++ b/pyload/plugin/Plugin.py @@ -13,8 +13,8 @@ import urllib import urlparse if os.name != "nt": - from pwd import getpwnam - from grp import getgrnam + import grp + import pwd from pyload.utils import fs_decode, fs_encode, safe_filename, fs_join, encode @@ -545,9 +545,9 @@ class Plugin(Base): res = encode(res) if self.core.debug: - from inspect import currentframe + import inspect - frame = currentframe() + frame = inspect.currentframe() framefile = fs_join("tmp", self.getClassName(), "%s_line%s.dump.html" % (frame.f_back.f_code.co_name, frame.f_back.f_lineno)) try: if not os.path.exists(os.path.join("tmp", self.getClassName())): @@ -622,8 +622,8 @@ class Plugin(Base): os.makedirs(location, int(self.core.config.get("permission", "folder"), 8)) if self.core.config.get("permission", "change_dl") and os.name != "nt": - uid = getpwnam(self.core.config.get("permission", "user"))[2] - gid = getgrnam(self.core.config.get("permission", "group"))[2] + uid = pwd.getpwnam(self.core.config.get("permission", "user"))[2] + gid = grp.getgrnam(self.core.config.get("permission", "group"))[2] os.chown(location, uid, gid) except Exception, e: @@ -662,8 +662,8 @@ class Plugin(Base): if self.core.config.get("permission", "change_dl") and os.name != "nt": try: - uid = getpwnam(self.core.config.get("permission", "user"))[2] - gid = getgrnam(self.core.config.get("permission", "group"))[2] + uid = pwd.getpwnam(self.core.config.get("permission", "user"))[2] + gid = grp.getgrnam(self.core.config.get("permission", "group"))[2] os.chown(fs_filename, uid, gid) except Exception, e: diff --git a/pyload/plugin/account/OboomCom.py b/pyload/plugin/account/OboomCom.py index 4669ca61e..b140b9282 100644 --- a/pyload/plugin/account/OboomCom.py +++ b/pyload/plugin/account/OboomCom.py @@ -4,8 +4,8 @@ try: from beaker.crypto.pbkdf2 import PBKDF2 except ImportError: + import binascii from beaker.crypto.pbkdf2 import pbkdf2 - from binascii import b2a_hex class PBKDF2(object): @@ -16,7 +16,7 @@ except ImportError: def hexread(self, octets): - return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) + return binascii.b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) from pyload.utils import json_loads from pyload.plugin.Account import Account diff --git a/pyload/plugin/account/SmoozedCom.py b/pyload/plugin/account/SmoozedCom.py index 63381c20b..ae666b060 100644 --- a/pyload/plugin/account/SmoozedCom.py +++ b/pyload/plugin/account/SmoozedCom.py @@ -7,8 +7,8 @@ try: from beaker.crypto.pbkdf2 import PBKDF2 except ImportError: + import binascii from beaker.crypto.pbkdf2 import pbkdf2 - from binascii import b2a_hex class PBKDF2(object): @@ -19,7 +19,7 @@ except ImportError: def hexread(self, octets): - return b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) + return binascii.b2a_hex(pbkdf2(self.passphrase, self.salt, self.iterations, octets)) from pyload.utils import json_loads from pyload.plugin.Account import Account diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index 53bf5559d..27e773a8c 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -52,8 +52,8 @@ except ImportError: pass if os.name != "nt": - from grp import getgrnam - from pwd import getpwnam + import grp + import pwd from pyload.plugin.Addon import Addon, threaded, Expose from pyload.plugin.Extractor import ArchiveError, CRCError, PasswordError @@ -563,8 +563,8 @@ class ExtractArchive(Addon): os.chmod(f, int(self.config.get("permission", "folder"), 8)) if self.config.get("permission", "change_dl") and os.name != "nt": - uid = getpwnam(self.config.get("permission", "user"))[2] - gid = getgrnam(self.config.get("permission", "group"))[2] + uid = pwd.getpwnam(self.config.get("permission", "user"))[2] + gid = grp.getgrnam(self.config.get("permission", "group"))[2] os.chown(f, uid, gid) except Exception, e: -- cgit v1.2.3