From 70f88ed37d33cccd46a167ba81f2c953936d75d7 Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Tue, 14 Nov 2023 23:04:18 +0200 Subject: [PATCH] Run isort on project Signed-off-by: Alfred Wingate --- bin/euscan | 10 ++++------ bin/euscan_patch_metadata | 17 ++++++++--------- src/euscan/__init__.py | 1 - src/euscan/ebuild.py | 7 ++----- src/euscan/handlers/__init__.py | 6 +++--- src/euscan/handlers/berlios.py | 8 +++++--- src/euscan/handlers/cpan.py | 11 +++++++---- src/euscan/handlers/deb.py | 8 +++++--- src/euscan/handlers/freecode.py | 6 ++++-- src/euscan/handlers/generic.py | 20 +++++++++++--------- src/euscan/handlers/github.py | 6 ++++-- src/euscan/handlers/gnome.py | 6 ++++-- src/euscan/handlers/google_code.py | 3 ++- src/euscan/handlers/php.py | 9 ++++++--- src/euscan/handlers/pypi.py | 4 ++-- src/euscan/handlers/rubygems.py | 11 +++++++---- src/euscan/handlers/sourceforge.py | 4 ++-- src/euscan/handlers/url.py | 6 ++++-- src/euscan/helpers.py | 13 +++++++------ src/euscan/out.py | 12 ++++++------ src/euscan/scan.py | 14 ++++++-------- 21 files changed, 99 insertions(+), 83 deletions(-) diff --git a/bin/euscan b/bin/euscan index ff45b79..ecf9c51 100755 --- a/bin/euscan +++ b/bin/euscan @@ -17,23 +17,21 @@ __description__ = "A tool to detect new upstream releases." # Imports -import sys import getopt +import sys from errno import EINTR, EINVAL from http.client import HTTPConnection -from portage import settings -from portage.output import white, yellow, turquoise, green -from portage.exception import AmbiguousPackageName - from gentoolkit import pprinter as pp from gentoolkit.errors import GentoolkitException +from portage import settings +from portage.exception import AmbiguousPackageName +from portage.output import green, turquoise, white, yellow from euscan import CONFIG, output from euscan.out import progress_bar from euscan._version import __version__ - # Globals isatty = os.environ.get("TERM") != "dumb" and sys.stdout.isatty() isatty_stderr = os.environ.get("TERM") != "dumb" and sys.stderr.isatty() diff --git a/bin/euscan_patch_metadata b/bin/euscan_patch_metadata index 84ee914..cd67f76 100755 --- a/bin/euscan_patch_metadata +++ b/bin/euscan_patch_metadata @@ -1,20 +1,19 @@ #!/usr/bin/env python -import os -import sys -import re -import urllib -from tempfile import mkstemp -import tarfile import gzip import logging +import os +import re import shutil +import sys +import tarfile +import urllib from difflib import unified_diff +from tempfile import mkstemp -from portage.exception import AmbiguousPackageName -from gentoolkit.query import Query from BeautifulSoup import BeautifulSoup, SoupStrainer - +from gentoolkit.query import Query +from portage.exception import AmbiguousPackageName logger = logging.getLogger(__name__) diff --git a/src/euscan/__init__.py b/src/euscan/__init__.py index c9127d1..7b9ac92 100644 --- a/src/euscan/__init__.py +++ b/src/euscan/__init__.py @@ -7,7 +7,6 @@ import configparser import os from ast import literal_eval - CONFIG = { "nocolor": False, "quiet": False, diff --git a/src/euscan/ebuild.py b/src/euscan/ebuild.py index f296607..70ff038 100644 --- a/src/euscan/ebuild.py +++ b/src/euscan/ebuild.py @@ -1,13 +1,10 @@ +import importlib import os import sys -import importlib import portage +from portage import _encodings, _shell_quote, _unicode_decode, _unicode_encode from portage.const import VDB_PATH -from portage import _encodings -from portage import _shell_quote -from portage import _unicode_decode -from portage import _unicode_encode # Stolen from the ebuild command diff --git a/src/euscan/handlers/__init__.py b/src/euscan/handlers/__init__.py index 7b9d37b..b19c57b 100644 --- a/src/euscan/handlers/__init__.py +++ b/src/euscan/handlers/__init__.py @@ -1,11 +1,11 @@ import os -import sys import pkgutil - -from euscan import CONFIG, output +import sys from portage.xml.metadata import MetaDataXML +from euscan import CONFIG, output + handlers = {"package": [], "url": [], "all": {}} # autoimport all modules in this directory and append them to handlers list diff --git a/src/euscan/handlers/berlios.py b/src/euscan/handlers/berlios.py index 2b852b3..690d66d 100644 --- a/src/euscan/handlers/berlios.py +++ b/src/euscan/handlers/berlios.py @@ -1,11 +1,13 @@ import re -import urllib.request, urllib.parse, urllib.error +import urllib.error +import urllib.parse +import urllib.request import portage -from euscan.helpers import regex_from_template -from euscan.handlers.url import process_scan as url_scan from euscan import output +from euscan.handlers.url import process_scan as url_scan +from euscan.helpers import regex_from_template HANDLER_NAME = "berlios" CONFIDENCE = 90 diff --git a/src/euscan/handlers/cpan.py b/src/euscan/handlers/cpan.py index 952c460..fbd82b6 100644 --- a/src/euscan/handlers/cpan.py +++ b/src/euscan/handlers/cpan.py @@ -1,9 +1,12 @@ -import re -import portage -import urllib.request, urllib.error, urllib.parse import json +import re +import urllib.error +import urllib.parse +import urllib.request -from euscan import helpers, output, mangling +import portage + +from euscan import helpers, mangling, output HANDLER_NAME = "cpan" CONFIDENCE = 100 diff --git a/src/euscan/handlers/deb.py b/src/euscan/handlers/deb.py index 983a58c..f0de1fe 100644 --- a/src/euscan/handlers/deb.py +++ b/src/euscan/handlers/deb.py @@ -1,11 +1,13 @@ -import urllib.request, urllib.parse, urllib.error -import re import bz2 +import re +import urllib.error +import urllib.parse +import urllib.request import zlib import portage -from euscan import mangling, helpers, output +from euscan import helpers, mangling, output HANDLER_NAME = "deb" CONFIDENCE = 100 diff --git a/src/euscan/handlers/freecode.py b/src/euscan/handlers/freecode.py index 9d988eb..8980d45 100644 --- a/src/euscan/handlers/freecode.py +++ b/src/euscan/handlers/freecode.py @@ -1,9 +1,11 @@ -import urllib.request, urllib.parse, urllib.error import re +import urllib.error +import urllib.parse +import urllib.request import portage -from euscan import mangling, helpers, output +from euscan import helpers, mangling, output HANDLER_NAME = "freecode" CONFIDENCE = 100 diff --git a/src/euscan/handlers/generic.py b/src/euscan/handlers/generic.py index d6dacf4..c6aa28c 100644 --- a/src/euscan/handlers/generic.py +++ b/src/euscan/handlers/generic.py @@ -1,8 +1,10 @@ -from urllib.parse import urljoin, urlparse -import urllib.request, urllib.error, urllib.parse -import re -import io import difflib +import io +import re +import urllib.error +import urllib.parse +import urllib.request +from urllib.parse import urljoin, urlparse try: from BeautifulSoup import BeautifulSoup @@ -12,13 +14,13 @@ except ImportError: import portage from euscan import ( - output, - helpers, - mangling, - CONFIG, - SCANDIR_BLACKLIST_URLS, BRUTEFORCE_BLACKLIST_PACKAGES, BRUTEFORCE_BLACKLIST_URLS, + CONFIG, + SCANDIR_BLACKLIST_URLS, + helpers, + mangling, + output, ) HANDLER_NAME = "generic" diff --git a/src/euscan/handlers/github.py b/src/euscan/handlers/github.py index 4f87271..247b457 100644 --- a/src/euscan/handlers/github.py +++ b/src/euscan/handlers/github.py @@ -1,10 +1,12 @@ import json -import urllib.request, urllib.error, urllib.parse import re +import urllib.error +import urllib.parse +import urllib.request import portage -from euscan import helpers, output, mangling +from euscan import helpers, mangling, output HANDLER_NAME = "github" CONFIDENCE = 100 diff --git a/src/euscan/handlers/gnome.py b/src/euscan/handlers/gnome.py index 3464120..0ab8927 100644 --- a/src/euscan/handlers/gnome.py +++ b/src/euscan/handlers/gnome.py @@ -1,7 +1,9 @@ # -*- coding: utf-8 -*- import re -import urllib.request, urllib.error, urllib.parse +import urllib.error +import urllib.parse +import urllib.request try: import simplejson as json @@ -10,7 +12,7 @@ except ImportError: import portage -from euscan import mangling, helpers, output +from euscan import helpers, mangling, output HANDLER_NAME = "gnome" CONFIDENCE = 100 diff --git a/src/euscan/handlers/google_code.py b/src/euscan/handlers/google_code.py index d01993d..b3591a3 100644 --- a/src/euscan/handlers/google_code.py +++ b/src/euscan/handlers/google_code.py @@ -1,9 +1,10 @@ import re + import portage from euscan import output -from euscan.helpers import regex_from_template from euscan.handlers.url import process_scan as url_scan +from euscan.helpers import regex_from_template HANDLER_NAME = "google-code" CONFIDENCE = 90 diff --git a/src/euscan/handlers/php.py b/src/euscan/handlers/php.py index db0b84a..e931375 100644 --- a/src/euscan/handlers/php.py +++ b/src/euscan/handlers/php.py @@ -1,9 +1,12 @@ import re -import portage -import urllib.request, urllib.error, urllib.parse +import urllib.error +import urllib.parse +import urllib.request import xml.dom.minidom -from euscan import helpers, output, mangling +import portage + +from euscan import helpers, mangling, output HANDLER_NAME = "php" CONFIDENCE = 100 diff --git a/src/euscan/handlers/pypi.py b/src/euscan/handlers/pypi.py index 9e9043a..dff8522 100644 --- a/src/euscan/handlers/pypi.py +++ b/src/euscan/handlers/pypi.py @@ -1,9 +1,9 @@ -import xmlrpc.client import re +import xmlrpc.client import portage -from euscan import mangling, helpers, output +from euscan import helpers, mangling, output HANDLER_NAME = "pypi" CONFIDENCE = 100 diff --git a/src/euscan/handlers/rubygems.py b/src/euscan/handlers/rubygems.py index 8f19d97..045f6b2 100644 --- a/src/euscan/handlers/rubygems.py +++ b/src/euscan/handlers/rubygems.py @@ -1,9 +1,12 @@ -import re -import portage import json -import urllib.request, urllib.error, urllib.parse +import re +import urllib.error +import urllib.parse +import urllib.request -from euscan import helpers, output, mangling +import portage + +from euscan import helpers, mangling, output HANDLER_NAME = "rubygems" CONFIDENCE = 100 diff --git a/src/euscan/handlers/sourceforge.py b/src/euscan/handlers/sourceforge.py index 01caed6..2c89892 100644 --- a/src/euscan/handlers/sourceforge.py +++ b/src/euscan/handlers/sourceforge.py @@ -2,9 +2,9 @@ import re import portage -from euscan.helpers import regex_from_template -from euscan.handlers.url import process_scan as url_scan from euscan import output +from euscan.handlers.url import process_scan as url_scan +from euscan.helpers import regex_from_template HANDLER_NAME = "sourceforge" CONFIDENCE = 90 diff --git a/src/euscan/handlers/url.py b/src/euscan/handlers/url.py index 41d380d..730fce4 100644 --- a/src/euscan/handlers/url.py +++ b/src/euscan/handlers/url.py @@ -1,8 +1,10 @@ import re -import urllib.request, urllib.error, urllib.parse +import urllib.error +import urllib.parse +import urllib.request +from euscan import helpers, output from euscan.handlers import generic -from euscan import output, helpers PRIORITY = 100 diff --git a/src/euscan/helpers.py b/src/euscan/helpers.py index c69f620..8339d51 100644 --- a/src/euscan/helpers.py +++ b/src/euscan/helpers.py @@ -1,21 +1,22 @@ +import errno import os import re -import errno -import urllib.request, urllib.error, urllib.parse +import urllib.error +import urllib.parse +import urllib.request from xml.dom.minidom import Document import portage from portage import dep try: - from urllib import robotparser - from urllib import urlparse + from urllib import robotparser, urlparse except ImportError: import urllib.robotparser import urllib.parse import euscan -from euscan import CONFIG, BLACKLIST_VERSIONS, ROBOTS_TXT_BLACKLIST_DOMAINS +from euscan import BLACKLIST_VERSIONS, CONFIG, ROBOTS_TXT_BLACKLIST_DOMAINS from euscan.version import parse_version @@ -267,7 +268,7 @@ def urlallowed(url): if baseurl in rpcache: rp = rpcache[baseurl] else: - from socket import setdefaulttimeout, getdefaulttimeout + from socket import getdefaulttimeout, setdefaulttimeout timeout = getdefaulttimeout() setdefaulttimeout(5) diff --git a/src/euscan/out.py b/src/euscan/out.py index 071588f..bb40346 100644 --- a/src/euscan/out.py +++ b/src/euscan/out.py @@ -1,14 +1,14 @@ -import sys -from io import StringIO -from collections import defaultdict import json -import signal -import time import re +import signal +import sys +import time +from collections import defaultdict +from io import StringIO import portage -from portage.output import EOutput, TermProgressBar from gentoolkit import pprinter as pp +from portage.output import EOutput, TermProgressBar from euscan.helpers import dict_to_xml diff --git a/src/euscan/scan.py b/src/euscan/scan.py index f16cade..106a30f 100644 --- a/src/euscan/scan.py +++ b/src/euscan/scan.py @@ -2,18 +2,16 @@ import os import sys from datetime import datetime -import portage - import gentoolkit.pprinter as pp -from gentoolkit.query import Query +import portage from gentoolkit.package import Package +from gentoolkit.query import Query -from euscan import CONFIG, BLACKLIST_PACKAGES -from euscan import handlers, output -from euscan.out import from_mirror -from euscan.helpers import version_blacklisted -from euscan.version import is_version_stable +from euscan import BLACKLIST_PACKAGES, CONFIG, handlers, output from euscan.ebuild import package_from_ebuild +from euscan.helpers import version_blacklisted +from euscan.out import from_mirror +from euscan.version import is_version_stable def filter_versions(cp, versions):