diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index ca3da4ae..bda10ff3 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -74,7 +74,7 @@ def select_slack_release(slack_rel): return slack_rel -class MetaData(object): +class MetaData: __all__ = "slpkg" __author__ = "dslackw" diff --git a/slpkg/auto_pkg.py b/slpkg/auto_pkg.py index fc1c160f..8aba4190 100644 --- a/slpkg/auto_pkg.py +++ b/slpkg/auto_pkg.py @@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_ from slpkg.pkg.manager import PackageManager -class Auto(object): +class Auto: """Select Slackware command to install packages """ def __init__(self, packages): diff --git a/slpkg/binary/dependency.py b/slpkg/binary/dependency.py index 9461dc9f..fe3e9495 100644 --- a/slpkg/binary/dependency.py +++ b/slpkg/binary/dependency.py @@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_ from slpkg.binary.greps import Requires -class Dependencies(object): +class Dependencies: """Resolving binary dependencies """ def __init__(self, repo, black): diff --git a/slpkg/binary/greps.py b/slpkg/binary/greps.py index 38988cc1..834f266b 100644 --- a/slpkg/binary/greps.py +++ b/slpkg/binary/greps.py @@ -144,7 +144,7 @@ def ktown_filter(name, location, size, unsize): return [fname, flocation, fsize, funsize] -class Requires(object): +class Requires: def __init__(self, name, repo): self.name = name diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index f0d1060c..01a28df5 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -50,7 +50,7 @@ from slpkg.binary.dependency import Dependencies from slpkg.slack.slack_version import slack_ver -class BinaryInstall(object): +class BinaryInstall: """Install binaries packages with all dependencies from repository """ diff --git a/slpkg/binary/repo_init.py b/slpkg/binary/repo_init.py index a6d47e5a..f6367977 100644 --- a/slpkg/binary/repo_init.py +++ b/slpkg/binary/repo_init.py @@ -30,7 +30,7 @@ from slpkg.slack.mirrors import mirrors from slpkg.slack.slack_version import slack_ver -class RepoInit(object): +class RepoInit: """Return PACKAGES.TXT and mirror by repository """ def __init__(self, repo): diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index d1d13ade..f6c6ff5b 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -29,7 +29,7 @@ from slpkg.splitting import split_package from slpkg.__metadata__ import MetaData as _meta_ -class BlackList(object): +class BlackList: """Blacklist class to add, remove or listed packages in blacklist file.""" def __init__(self): diff --git a/slpkg/checks.py b/slpkg/checks.py index b517e507..4ec49bc9 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -28,7 +28,7 @@ from slpkg.init import Initialization from slpkg.__metadata__ import MetaData as _meta_ -class Updates(object): +class Updates: """Checking for news in ChangeLog.txt """ def __init__(self, repo): diff --git a/slpkg/config.py b/slpkg/config.py index b0f0a048..e761cc2e 100644 --- a/slpkg/config.py +++ b/slpkg/config.py @@ -30,7 +30,7 @@ from slpkg.utils import Utils from slpkg.__metadata__ import MetaData as _meta_ -class Config(object): +class Config: """Print or edit slpkg configuration file """ def __init__(self): diff --git a/slpkg/desc.py b/slpkg/desc.py index f5042e1c..f555915b 100644 --- a/slpkg/desc.py +++ b/slpkg/desc.py @@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_ from slpkg.sbo.greps import SBoGrep -class PkgDesc(object): +class PkgDesc: """Print package description from the repository """ def __init__(self, name, repo, paint): diff --git a/slpkg/dialog_box.py b/slpkg/dialog_box.py index 1932e98b..7e680d65 100644 --- a/slpkg/dialog_box.py +++ b/slpkg/dialog_box.py @@ -27,7 +27,7 @@ from __future__ import unicode_literals import os -class DialogUtil(object): +class DialogUtil: """Create dialog checklist """ def __init__(self, *args): diff --git a/slpkg/downloader.py b/slpkg/downloader.py index 58a0a9d5..d93cd3d1 100644 --- a/slpkg/downloader.py +++ b/slpkg/downloader.py @@ -32,7 +32,7 @@ from slpkg.slack.slack_version import slack_ver from slpkg.__metadata__ import MetaData as _meta_ -class Download(object): +class Download: """Downloader manager. Slpkg use wget by default but support curl, aria2 and httpie """ diff --git a/slpkg/file_size.py b/slpkg/file_size.py index 2aec32e0..3dd901a6 100644 --- a/slpkg/file_size.py +++ b/slpkg/file_size.py @@ -26,7 +26,7 @@ import os import requests -class FileSize(object): +class FileSize: """Check local or remote file size """ def __init__(self, registry): diff --git a/slpkg/graph.py b/slpkg/graph.py index d874c4ac..561ddfd0 100644 --- a/slpkg/graph.py +++ b/slpkg/graph.py @@ -26,7 +26,7 @@ import os import subprocess -class Graph(object): +class Graph: """Drawing dependencies diagram """ def __init__(self, image): diff --git a/slpkg/health.py b/slpkg/health.py index b8e011c5..2fad4187 100644 --- a/slpkg/health.py +++ b/slpkg/health.py @@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_ from slpkg.pkg.find import find_package -class PackageHealth(object): +class PackageHealth: """Health check installed packages """ def __init__(self, mode): diff --git a/slpkg/init.py b/slpkg/init.py index 4386703d..209c3ed6 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -34,7 +34,7 @@ from slpkg.slack.mirrors import mirrors from slpkg.slack.slack_version import slack_ver -class Initialization(object): +class Initialization: """Slpkg initialization start all from here. Create local package lists and update or upgrade these. """ diff --git a/slpkg/load.py b/slpkg/load.py index 119dc21c..ee88c308 100644 --- a/slpkg/load.py +++ b/slpkg/load.py @@ -57,7 +57,7 @@ def library(repo): return pkg_list -class Regex(object): +class Regex: """Grap packages with simple regex using asterisk * with options: starts with string* ends with *string diff --git a/slpkg/log_deps.py b/slpkg/log_deps.py index 7ddac2c1..8ef9eb11 100644 --- a/slpkg/log_deps.py +++ b/slpkg/log_deps.py @@ -44,4 +44,3 @@ def write_deps(deps_dict): with open(dep_path + name, "w") as f: for dep in dependencies: f.write(dep + "\n") - f.close() diff --git a/slpkg/main.py b/slpkg/main.py index 464e37a6..f334e4f1 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -66,7 +66,7 @@ from slpkg.binary.check import pkg_upgrade from slpkg.binary.install import BinaryInstall -class ArgParse(object): +class ArgParse: def __init__(self, args): self.args = args diff --git a/slpkg/messages.py b/slpkg/messages.py index 844c3155..93d75bb4 100644 --- a/slpkg/messages.py +++ b/slpkg/messages.py @@ -27,7 +27,7 @@ import itertools from slpkg.__metadata__ import MetaData as _meta_ -class Msg(object): +class Msg: """Messages control """ def __init__(self): @@ -70,22 +70,22 @@ class Msg(object): """Message checking """ print("{0}Checking...{1} ".format(self.meta.color["GREY"], - self.meta.color["ENDC"]), end="") - print(end="", flush=True) + self.meta.color["ENDC"]), end="", + flush=True) def reading(self): """Message reading """ print("{0}Reading package lists...{1} ".format( - self.meta.color["GREY"], self.meta.color["ENDC"]), end="") - print(end="", flush=True) + self.meta.color["GREY"], self.meta.color["ENDC"]), end="", + flush=True) def resolving(self): """Message resolving """ print("{0}Resolving dependencies...{1} ".format( - self.meta.color["GREY"], self.meta.color["ENDC"]), end="") - print(end="", flush=True) + self.meta.color["GREY"], self.meta.color["ENDC"]), end="", + flush=True) def done(self): """Message done diff --git a/slpkg/new_config.py b/slpkg/new_config.py index e19741ff..610c8a5e 100644 --- a/slpkg/new_config.py +++ b/slpkg/new_config.py @@ -31,7 +31,7 @@ from slpkg.utils import Utils from slpkg.__metadata__ import MetaData as _meta_ -class NewConfig(object): +class NewConfig: """Manage .new configuration files """ def __init__(self): @@ -187,15 +187,15 @@ class NewConfig(object): diff1 = Utils().read_file(n[:-4]).splitlines() if os.path.isfile(n): diff2 = Utils().read_file(n).splitlines() - lines, l, c = [], 0, 0 + lines, ln, c = [], 0, 0 for a, b in itertools.izip_longest(diff1, diff2): - l += 1 + ln += 1 if a != b: for s1, s2 in itertools.izip_longest(str(a), str(b)): c += 1 if s1 != s2: break - print("@@ -{0},{1} +{2},{3} @@\n".format(l, c, l, c)) + print("@@ -{0},{1} +{2},{3} @@\n".format(ln, c, ln, c)) for line in lines[-3:]: print("{0}".format(line)) if a is None: diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py index 018627ab..33f1278b 100644 --- a/slpkg/pkg/build.py +++ b/slpkg/pkg/build.py @@ -39,7 +39,7 @@ from slpkg.__metadata__ import MetaData as _meta_ from slpkg.sbo.greps import SBoGrep -class BuildPackage(object): +class BuildPackage: """Build SBo packages from source """ def __init__(self, script, sources, path, auto): diff --git a/slpkg/pkg/installed.py b/slpkg/pkg/installed.py index b924e721..d2085d73 100644 --- a/slpkg/pkg/installed.py +++ b/slpkg/pkg/installed.py @@ -28,7 +28,7 @@ from slpkg.splitting import split_package from slpkg.__metadata__ import MetaData as _meta_ -class GetFromInstalled(object): +class GetFromInstalled: """Find and return version and package name from already installed packages """ diff --git a/slpkg/pkg/manager.py b/slpkg/pkg/manager.py index ffadc56d..016cda25 100644 --- a/slpkg/pkg/manager.py +++ b/slpkg/pkg/manager.py @@ -39,7 +39,7 @@ from slpkg.__metadata__ import MetaData as _meta_ from slpkg.slack.slackware_repo import slackware_repository -class PackageManager(object): +class PackageManager: """Package manager class for install, upgrade, reinstall, remove, find and display packages""" def __init__(self, binary): @@ -520,9 +520,9 @@ class PackageManager(object): self.meta.color["ENDC"], pkg)) if index == page: read = input("\nPress {0}Enter{1} to " - "continue... ".format( - self.meta.color["CYAN"], - self.meta.color["ENDC"])) + "continue... ".format( + self.meta.color["CYAN"], + self.meta.color["ENDC"])) if read in ["Q", "q"]: break print() # new line after page diff --git a/slpkg/pkg_find.py b/slpkg/pkg_find.py index af197e01..97d59921 100644 --- a/slpkg/pkg_find.py +++ b/slpkg/pkg_find.py @@ -28,7 +28,7 @@ from slpkg.pkg.manager import PackageManager from slpkg.__metadata__ import MetaData as _meta_ -class FindFromRepos(object): +class FindFromRepos: """Find packages from all enabled repositories """ def __init__(self): @@ -53,7 +53,8 @@ class FindFromRepos(object): Msg().template(78) for repo in _meta_.repositories: PACKAGES_TXT = PackageManager(pkg).list_lib(repo) - packages, sizes = PackageManager(pkg).list_greps(repo, PACKAGES_TXT) + packages, sizes = PackageManager(pkg).list_greps(repo, + PACKAGES_TXT) for find, size in zip(packages, sizes): for p in pkg: if "--case-ins" in flag: diff --git a/slpkg/repoenable.py b/slpkg/repoenable.py index 6c5dde1d..19aeb895 100644 --- a/slpkg/repoenable.py +++ b/slpkg/repoenable.py @@ -30,7 +30,7 @@ from slpkg.dialog_box import DialogUtil from slpkg.__metadata__ import MetaData as _meta_ -class RepoEnable(object): +class RepoEnable: """Read repositories.conf file and update with new enabled or disabled repositories """ diff --git a/slpkg/repoinfo.py b/slpkg/repoinfo.py index 773092ff..8bcfc64f 100644 --- a/slpkg/repoinfo.py +++ b/slpkg/repoinfo.py @@ -31,7 +31,7 @@ from slpkg.repolist import RepoList from slpkg.__metadata__ import MetaData as _meta_ -class RepoInfo(object): +class RepoInfo: """Repository information """ def __init__(self): @@ -78,8 +78,8 @@ class RepoInfo(object): self.form["Number of packages:"] = data[0] self.form["Status:"] = status self.form["Last updated:"] = data[3] - elif (repo == "sbo" and os.path.isfile(self.meta.lib_path + "{0}_repo/" - "SLACKBUILDS.TXT".format(repo))): + elif (repo == "sbo" and os.path.isfile( + self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(repo))): status = "{0}enabled{1}".format(self.meta.color["GREEN"], self.meta.color["ENDC"]) sum_sbo_pkgs = 0 @@ -100,7 +100,8 @@ class RepoInfo(object): self.form["Last updated:"] = last_upd print() for key, value in sorted(self.form.items()): - print(self.meta.color["GREY"] + key + self.meta.color["ENDC"], value) + print(self.meta.color["GREY"] + key + self.meta.color["ENDC"], + value) print() raise SystemExit() @@ -109,8 +110,8 @@ class RepoInfo(object): Grap data packages """ sum_pkgs, size, unsize, last_upd = 0, [], [], "" - for line in (Utils().read_file( - self.meta.lib_path + repo + "_repo/PACKAGES.TXT").splitlines()): + f = self.meta.lib_path + repo + "_repo/PACKAGES.TXT" + for line in Utils().read_file(f).splitlines(): if line.startswith("PACKAGES.TXT;"): last_upd = line[14:].strip() if line.startswith("PACKAGE NAME:"): diff --git a/slpkg/repolist.py b/slpkg/repolist.py index 8fcb2aa6..7f372db9 100644 --- a/slpkg/repolist.py +++ b/slpkg/repolist.py @@ -27,7 +27,7 @@ from slpkg.repositories import Repo from slpkg.__metadata__ import MetaData as _meta_ -class RepoList(object): +class RepoList: """List of repositories """ def __init__(self): diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 44170ed1..c4d4f1ed 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -28,7 +28,7 @@ from slpkg.utils import Utils from slpkg.__metadata__ import MetaData as _meta_ -class Repo(object): +class Repo: """Manage repositories configuration files """ def __init__(self): @@ -36,7 +36,8 @@ class Repo(object): self.DEFAULT_REPOS_NAMES = self.meta.default_repositories self.custom_repo_file = "/etc/slpkg/custom-repositories" self.default_repo_file = "/etc/slpkg/default-repositories" - self.custom_repositories_list = Utils().read_file(self.custom_repo_file) + self.custom_repositories_list = Utils().read_file( + self.custom_repo_file) self.default_repositories_list = Utils().read_file( self.default_repo_file) self.default_repository() @@ -62,9 +63,9 @@ class Repo(object): "six (6) characters\n") raise SystemExit() with open(self.custom_repo_file, "a") as repos: - new_line = " {0}{1}{2}\n".format(repo, " " * (10 - len(repo)), url) + new_line = " {0}{1}{2}\n".format(repo, " " * (10 - len(repo)), + url) repos.write(new_line) - repos.close() print("\nRepository '{0}' successfully added\n".format(repo)) raise SystemExit() diff --git a/slpkg/sbo/autobuild.py b/slpkg/sbo/autobuild.py index e5b04b18..bfb29867 100644 --- a/slpkg/sbo/autobuild.py +++ b/slpkg/sbo/autobuild.py @@ -29,7 +29,7 @@ from slpkg.pkg.build import BuildPackage from slpkg.sbo.greps import SBoGrep -class AutoBuild(object): +class AutoBuild: """Autobuild package if sources and script is already downloaded """ diff --git a/slpkg/sbo/build_num.py b/slpkg/sbo/build_num.py index 6eb75738..43fe7fca 100644 --- a/slpkg/sbo/build_num.py +++ b/slpkg/sbo/build_num.py @@ -29,7 +29,7 @@ from slpkg.url_read import URL from slpkg.__metadata__ import MetaData as _meta_ -class BuildNumber(object): +class BuildNumber: """Get build number from SlackBuild script """ def __init__(self, sbo_url, pkg): diff --git a/slpkg/sbo/compressed.py b/slpkg/sbo/compressed.py index 637c17d2..17db6ca8 100644 --- a/slpkg/sbo/compressed.py +++ b/slpkg/sbo/compressed.py @@ -22,7 +22,7 @@ # along with this program. If not, see . -class SBoLink(object): +class SBoLink: """Create slackbuild tar.gz archive from url """ def __init__(self, sbo_url): diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index 9535d314..afb5b1dd 100644 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -31,7 +31,7 @@ from slpkg.__metadata__ import MetaData as _meta_ from slpkg.sbo.greps import SBoGrep -class Requires(object): +class Requires: """Resolving SBo dependencies """ def __init__(self, flag): diff --git a/slpkg/sbo/greps.py b/slpkg/sbo/greps.py index d987971c..4412fb03 100644 --- a/slpkg/sbo/greps.py +++ b/slpkg/sbo/greps.py @@ -26,7 +26,7 @@ from slpkg.utils import Utils from slpkg.__metadata__ import MetaData as _meta_ -class SBoGrep(object): +class SBoGrep: """Grab data from SLACKBUILDS.TXT file """ def __init__(self, name): diff --git a/slpkg/sbo/network.py b/slpkg/sbo/network.py index 5c432320..45f14ba2 100644 --- a/slpkg/sbo/network.py +++ b/slpkg/sbo/network.py @@ -49,7 +49,7 @@ from slpkg.sbo.slack_find import slack_package from slpkg.slack.slack_version import slack_ver -class SBoNetwork(object): +class SBoNetwork: """View SBo site in terminal and also read, build or install packages """ diff --git a/slpkg/sbo/queue.py b/slpkg/sbo/queue.py index 7ae2de2d..eb1c86fd 100644 --- a/slpkg/sbo/queue.py +++ b/slpkg/sbo/queue.py @@ -39,7 +39,7 @@ from slpkg.sbo.search import sbo_search_pkg from slpkg.sbo.slack_find import slack_package -class QueuePkgs(object): +class QueuePkgs: """Manage SBo packages, add or remove for building or installation """ diff --git a/slpkg/sbo/read.py b/slpkg/sbo/read.py index 72d55b5c..bb6190b6 100644 --- a/slpkg/sbo/read.py +++ b/slpkg/sbo/read.py @@ -25,7 +25,7 @@ from slpkg.url_read import URL -class ReadSBo(object): +class ReadSBo: """Read SBo files from urls """ def __init__(self, sbo_url): diff --git a/slpkg/sbo/sbo_arch.py b/slpkg/sbo/sbo_arch.py index 9e0f6b3a..e136af07 100644 --- a/slpkg/sbo/sbo_arch.py +++ b/slpkg/sbo/sbo_arch.py @@ -25,7 +25,7 @@ from slpkg.__metadata__ import MetaData as _meta_ -class SBoArch(object): +class SBoArch: """Manage computer architecture for sbo repository """ def __init__(self): diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 2a939340..4c3aa40a 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -49,7 +49,7 @@ from slpkg.sbo.search import sbo_search_pkg from slpkg.sbo.slack_find import slack_package -class SBoInstall(object): +class SBoInstall: """Build and install SBo packages with all dependencies """ def __init__(self, slackbuilds, flag): diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index c53bf385..2d99f31f 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -51,7 +51,7 @@ from slpkg.slack.mirrors import mirrors from slpkg.slack.slack_version import slack_ver -class Patches(object): +class Patches: """Upgrade distribution from official Slackware mirrors """ def __init__(self, skip, flag): diff --git a/slpkg/status_deps.py b/slpkg/status_deps.py index 88ea6d91..3ba896cf 100644 --- a/slpkg/status_deps.py +++ b/slpkg/status_deps.py @@ -34,7 +34,7 @@ from slpkg.__metadata__ import MetaData as _meta_ from slpkg.pkg.find import find_package -class DependenciesStatus(object): +class DependenciesStatus: """Print dependencies status used by packages """ def __init__(self, image): @@ -111,8 +111,7 @@ class DependenciesStatus(object): for d in dep: print("+-- {0}".format(d)) print("|") - print("\x1b[1A{0}\n".format(" "), end="") - print(end="", flush=True) + print("\x1b[1A{0}\n".format(" "), end="", flush=True) self.summary() if self.image: Graph(self.image).dependencies(self.dmap) diff --git a/slpkg/tracking.py b/slpkg/tracking.py index e41ad82a..60e133b0 100644 --- a/slpkg/tracking.py +++ b/slpkg/tracking.py @@ -38,7 +38,7 @@ from slpkg.binary.search import search_pkg from slpkg.binary.dependency import Dependencies -class TrackingDeps(object): +class TrackingDeps: """View tree of dependencies and also highlight packages with color green if already installed and color red diff --git a/slpkg/url_read.py b/slpkg/url_read.py index 5d1daa90..4cb17e57 100644 --- a/slpkg/url_read.py +++ b/slpkg/url_read.py @@ -27,7 +27,7 @@ import requests from slpkg.__metadata__ import MetaData as _meta_ -class URL(object): +class URL: """Urls reading class """ def __init__(self, link): diff --git a/slpkg/utils.py b/slpkg/utils.py index e423fabc..d3a39357 100644 --- a/slpkg/utils.py +++ b/slpkg/utils.py @@ -27,7 +27,7 @@ import os from slpkg.splitting import split_package -class Utils(object): +class Utils: """Class with usefull utilities """ def case_sensitive(self, lst):