diff --git a/application/conf.py b/application/conf.py index 9fb013c..4628672 100644 --- a/application/conf.py +++ b/application/conf.py @@ -12,4 +12,4 @@ HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0", "Accept-Language": "en-US,en;q=0.5", -} \ No newline at end of file +} diff --git a/application/defaults.py b/application/defaults.py index 400a438..db8a6a6 100644 --- a/application/defaults.py +++ b/application/defaults.py @@ -3,4 +3,4 @@ THREADS = 1 TIMEOUT = 5 -DELAY = 1 \ No newline at end of file +DELAY = 1 diff --git a/application/helpers.py b/application/helpers.py index c269dfc..e7313fa 100644 --- a/application/helpers.py +++ b/application/helpers.py @@ -12,4 +12,4 @@ def readTextFile(filePath): return ts.readAll() def writeTextFile(filePath, fileContents): - pass \ No newline at end of file + pass diff --git a/application/utils.py b/application/utils.py index 04500cc..2302e71 100644 --- a/application/utils.py +++ b/application/utils.py @@ -1,14 +1,14 @@ # -*- coding: UTF-8 -*- #!/usr/bin/env python -from time import sleep -from urllib.parse import urljoin, urlparse +#from time import sleep +from urllib.parse import urlparse from lxml import etree import requests -from .conf import HEADERS -from .defaults import TIMEOUT +from application.conf import HEADERS +from application.defaults import TIMEOUT def check_alexa(url, timeout=TIMEOUT): rank = None @@ -34,9 +34,48 @@ def check_alexa(url, timeout=TIMEOUT): return rank, status, msg def extract_domain(url): + """ + Extracts domain from url + + Parameters + ---------- + url : str + Full url address + + Returns + ------- + str + Url domain + + Examples + -------- + >>> extract_domain("https://www.python.org/about/") + 'www.python.org' + """ return urlparse(url).netloc def split_list(li, n): + """ + Split list into n lists + + Parameters + ---------- + li : list + List to split + + n : int + Split count + + Returns + ------- + list + List of n lists + + Examples + -------- + >>> split_list([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 3) + [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10]] + """ k, m = divmod(len(li), n) - return (li[i * k + min(i, m):(i + 1) * k + min(i + 1, m)] for i in range(n)) \ No newline at end of file + return [li[i * k + min(i, m):(i + 1) * k + min(i + 1, m)] for i in range(n)] \ No newline at end of file diff --git a/application/version.py b/application/version.py index 768b4ae..3adca41 100644 --- a/application/version.py +++ b/application/version.py @@ -1,4 +1,4 @@ # -*- coding: UTF-8 -*- # !/usr/bin/env python -__version__ = "0.5.12.1" \ No newline at end of file +__version__ = "0.5.12.1" diff --git a/main.py b/main.py index 42b3bd1..39b1cfe 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,9 @@ # -*- coding: UTF-8 -*- # !/usr/bin/env python -import os import sys -from PyQt5 import uic, QtWidgets +from PyQt5 import QtWidgets from application.mainwindow import MainWindow from application.conf import __author__, __title__ @@ -18,4 +17,4 @@ app.setStyleSheet("QStatusBar::item { border: 0px solid black };") mainWindow = MainWindow() mainWindow.show() - app.exec_() \ No newline at end of file + app.exec_()