aboutsummaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAksh Gupta <akshgpt7@gmail.com>2021-03-10 08:40:06 +0000
committerAksh Gupta <akshgpt7@gmail.com>2021-03-10 22:59:47 +0530
commitea8d2cfdfe3834e1dbb0ef0e12beb7da41a033f2 (patch)
treef809dcc93a03c1be03d488c00b427850705ea671 /desktop
parentdd8742535f99f9c51c890aa893966f1146f6ffaf (diff)
downloadonionshare-ea8d2cfdfe3834e1dbb0ef0e12beb7da41a033f2.tar.gz
onionshare-ea8d2cfdfe3834e1dbb0ef0e12beb7da41a033f2.zip
chore: refactor code quality issues
Diffstat (limited to 'desktop')
-rwxr-xr-xdesktop/package/linux/build-appimage.py1
-rw-r--r--desktop/package/windows/build.py1
-rwxr-xr-xdesktop/scripts/check_lacked_trans.py5
-rwxr-xr-xdesktop/scripts/get-tor-osx.py2
-rwxr-xr-xdesktop/scripts/rebuild-cli.py1
-rw-r--r--desktop/src/onionshare/gui_common.py1
-rw-r--r--desktop/src/onionshare/main_window.py2
-rw-r--r--desktop/src/onionshare/settings_dialog.py8
-rw-r--r--desktop/src/onionshare/strings.py1
-rw-r--r--desktop/src/onionshare/tab/server_status.py2
-rw-r--r--desktop/src/onionshare/threads.py4
-rw-r--r--desktop/src/onionshare/update_checker.py5
-rw-r--r--desktop/src/setup.py5
-rw-r--r--desktop/tests/conftest.py2
-rw-r--r--desktop/tests/gui_base_test.py7
-rw-r--r--desktop/tests/test_gui_share.py1
-rw-r--r--desktop/tests/test_gui_tabs.py1
-rw-r--r--desktop/tests/test_gui_website.py6
18 files changed, 8 insertions, 47 deletions
diff --git a/desktop/package/linux/build-appimage.py b/desktop/package/linux/build-appimage.py
index 73164b55..0c64494f 100755
--- a/desktop/package/linux/build-appimage.py
+++ b/desktop/package/linux/build-appimage.py
@@ -2,7 +2,6 @@
import os
import inspect
import subprocess
-import argparse
import shutil
import glob
diff --git a/desktop/package/windows/build.py b/desktop/package/windows/build.py
index 59929070..603b1514 100644
--- a/desktop/package/windows/build.py
+++ b/desktop/package/windows/build.py
@@ -2,7 +2,6 @@
import os
import inspect
import subprocess
-import argparse
import shutil
import glob
diff --git a/desktop/scripts/check_lacked_trans.py b/desktop/scripts/check_lacked_trans.py
index 965b103b..2456c995 100755
--- a/desktop/scripts/check_lacked_trans.py
+++ b/desktop/scripts/check_lacked_trans.py
@@ -105,11 +105,10 @@ def main():
if src[quote_i] == '"':
quote = '"'
break
- elif src[quote_i] == "'":
+ if src[quote_i] == "'":
quote = "'"
break
- else:
- inc += 1
+ inc += 1
# find the starting quote
starting_i = src.find(quote, starting_i)
diff --git a/desktop/scripts/get-tor-osx.py b/desktop/scripts/get-tor-osx.py
index bf0cb5bc..f3aa6e7b 100755
--- a/desktop/scripts/get-tor-osx.py
+++ b/desktop/scripts/get-tor-osx.py
@@ -29,8 +29,6 @@ import inspect
import os
import sys
import hashlib
-import zipfile
-import io
import shutil
import subprocess
import requests
diff --git a/desktop/scripts/rebuild-cli.py b/desktop/scripts/rebuild-cli.py
index c13461bc..66582cf1 100755
--- a/desktop/scripts/rebuild-cli.py
+++ b/desktop/scripts/rebuild-cli.py
@@ -6,7 +6,6 @@ and installs it in the virtual environment.
import inspect
import os
-import sys
import glob
import subprocess
import shutil
diff --git a/desktop/src/onionshare/gui_common.py b/desktop/src/onionshare/gui_common.py
index bd72246a..7703f7a8 100644
--- a/desktop/src/onionshare/gui_common.py
+++ b/desktop/src/onionshare/gui_common.py
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
-import inspect
import shutil
from pkg_resources import resource_filename
diff --git a/desktop/src/onionshare/main_window.py b/desktop/src/onionshare/main_window.py
index 2f6e91d0..d87092b6 100644
--- a/desktop/src/onionshare/main_window.py
+++ b/desktop/src/onionshare/main_window.py
@@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import time
from PySide2 import QtCore, QtWidgets, QtGui
-from onionshare_cli.web import Web
-
from . import strings
from .tor_connection_dialog import TorConnectionDialog
from .settings_dialog import SettingsDialog
diff --git a/desktop/src/onionshare/settings_dialog.py b/desktop/src/onionshare/settings_dialog.py
index 3f913bcd..190ae35d 100644
--- a/desktop/src/onionshare/settings_dialog.py
+++ b/desktop/src/onionshare/settings_dialog.py
@@ -24,8 +24,6 @@ import platform
import datetime
import re
import os
-
-from onionshare_cli import common
from onionshare_cli.settings import Settings
from onionshare_cli.onion import (
Onion,
@@ -47,11 +45,7 @@ from onionshare_cli.onion import (
from . import strings
from .widgets import Alert
from .update_checker import (
- UpdateCheckerCheckError,
- UpdateCheckerInvalidLatestVersion,
- UpdateChecker,
- UpdateThread,
-)
+ UpdateThread)
from .tor_connection_dialog import TorConnectionDialog
from .gui_common import GuiCommon
diff --git a/desktop/src/onionshare/strings.py b/desktop/src/onionshare/strings.py
index a3db202c..c4192a33 100644
--- a/desktop/src/onionshare/strings.py
+++ b/desktop/src/onionshare/strings.py
@@ -18,7 +18,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import json
-import locale
import os
strings = {}
diff --git a/desktop/src/onionshare/tab/server_status.py b/desktop/src/onionshare/tab/server_status.py
index 8c1c9655..d8266820 100644
--- a/desktop/src/onionshare/tab/server_status.py
+++ b/desktop/src/onionshare/tab/server_status.py
@@ -17,8 +17,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-
-import platform
import textwrap
from PySide2 import QtCore, QtWidgets, QtGui
from PySide2.QtCore import Qt
diff --git a/desktop/src/onionshare/threads.py b/desktop/src/onionshare/threads.py
index 214344f7..504591f6 100644
--- a/desktop/src/onionshare/threads.py
+++ b/desktop/src/onionshare/threads.py
@@ -158,14 +158,14 @@ class AutoStartTimer(QtCore.QThread):
)
try:
# Sleep until scheduled time
- while autostart_timer_datetime_delta > 0 and self.canceled == False:
+ while autostart_timer_datetime_delta > 0 and self.canceled is False:
time.sleep(0.1)
now = QtCore.QDateTime.currentDateTime()
autostart_timer_datetime_delta = now.secsTo(
self.mode.server_status.autostart_timer_datetime
)
# Timer has now finished
- if self.canceled == False:
+ if self.canceled is False:
self.mode.server_status.server_button.setText(
strings._("gui_please_wait")
)
diff --git a/desktop/src/onionshare/update_checker.py b/desktop/src/onionshare/update_checker.py
index 1d8e8b07..43c83828 100644
--- a/desktop/src/onionshare/update_checker.py
+++ b/desktop/src/onionshare/update_checker.py
@@ -19,14 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PySide2 import QtCore
-import datetime, time, socket, re, platform
+import datetime, re
import socks
from distutils.version import LooseVersion as Version
from onionshare_cli.settings import Settings
-from onionshare_cli.onion import Onion
-
-from . import strings
class UpdateCheckerCheckError(Exception):
diff --git a/desktop/src/setup.py b/desktop/src/setup.py
index 83aeeba1..c2c91d28 100644
--- a/desktop/src/setup.py
+++ b/desktop/src/setup.py
@@ -18,11 +18,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-
-# This setup.py file is used for snap and flatpak packaging. For other packaging,
-# OnionShare uses briefcase.
-
-import os
import setuptools
version = "2.3.1"
diff --git a/desktop/tests/conftest.py b/desktop/tests/conftest.py
index 65d13fa6..a043af0c 100644
--- a/desktop/tests/conftest.py
+++ b/desktop/tests/conftest.py
@@ -13,7 +13,7 @@ from datetime import datetime, timedelta
import pytest
-from PySide2 import QtTest, QtGui
+from PySide2 import QtTest
@staticmethod
diff --git a/desktop/tests/gui_base_test.py b/desktop/tests/gui_base_test.py
index 214da945..c6a5da2f 100644
--- a/desktop/tests/gui_base_test.py
+++ b/desktop/tests/gui_base_test.py
@@ -1,11 +1,7 @@
-import pytest
import unittest
-
-import json
import os
import requests
import shutil
-import base64
import tempfile
import secrets
import platform
@@ -13,9 +9,6 @@ import platform
from PySide2 import QtCore, QtTest, QtWidgets
from onionshare_cli.common import Common
-from onionshare_cli.settings import Settings
-from onionshare_cli.onion import Onion
-from onionshare_cli.web import Web
from onionshare import Application, MainWindow, GuiCommon
from onionshare.tab.mode.share_mode import ShareMode
diff --git a/desktop/tests/test_gui_share.py b/desktop/tests/test_gui_share.py
index 0e521d52..380d63f6 100644
--- a/desktop/tests/test_gui_share.py
+++ b/desktop/tests/test_gui_share.py
@@ -1,4 +1,3 @@
-import pytest
import os
import requests
import tempfile
diff --git a/desktop/tests/test_gui_tabs.py b/desktop/tests/test_gui_tabs.py
index 4ebbdffb..84558420 100644
--- a/desktop/tests/test_gui_tabs.py
+++ b/desktop/tests/test_gui_tabs.py
@@ -1,4 +1,3 @@
-import pytest
import os
from PySide2 import QtCore, QtTest, QtWidgets
diff --git a/desktop/tests/test_gui_website.py b/desktop/tests/test_gui_website.py
index 164aa07d..a838cb96 100644
--- a/desktop/tests/test_gui_website.py
+++ b/desktop/tests/test_gui_website.py
@@ -1,10 +1,6 @@
-import pytest
-import os
import requests
-import shutil
-from datetime import datetime, timedelta
-from PySide2 import QtCore, QtTest
+from PySide2 import QtTest
from .gui_base_test import GuiBaseTest