Fix flake8 warnings in desktop

This commit is contained in:
Micah Lee 2021-04-30 11:38:23 -07:00
parent cfbf07b903
commit bf08e29162
18 changed files with 35 additions and 44 deletions

View file

@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import division
import os
import sys
import platform
import argparse
import signal
import json

View file

@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PySide2 import QtCore, QtWidgets, QtGui
from PySide2 import QtCore, QtWidgets
from onionshare_cli.common import AutoStopTimer
@ -379,7 +379,7 @@ class Mode(QtWidgets.QWidget):
if self.server_status.status != ServerStatus.STATUS_STOPPED:
try:
self.web.stop(self.app.port)
except:
except Exception:
# Probably we had no port to begin with (Onion service didn't start)
pass
self.app.cleanup()

View file

@ -18,14 +18,8 @@ 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 os
import random
import string
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.onion import *
from onionshare_cli.common import Common
from onionshare_cli.web import Web
from .. import Mode

View file

@ -253,7 +253,7 @@ class ReceiveHistoryItemFile(QtWidgets.QWidget):
try:
# If nautilus is available, open it
subprocess.Popen(["xdg-open", self.dir])
except:
except Exception:
Alert(
self.common,
strings._("gui_open_folder_error").format(abs_filename),

View file

@ -234,7 +234,7 @@ class ModeSettingsWidget(QtWidgets.QWidget):
self.tab.change_title.emit(
self.tab.tab_id, strings._("gui_tab_name_chat")
)
elif self.tab_mode == None:
elif self.tab_mode is None:
pass
else:
title = self.title_lineedit.text()

View file

@ -21,7 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.onion import *
from onionshare_cli.common import Common
from onionshare_cli.web import Web
@ -30,7 +29,7 @@ from .. import Mode
from ..file_selection import FileSelection
from ..history import History, ToggleHistory, ShareHistoryItem
from .... import strings
from ....widgets import Alert, MinimumWidthWidget
from ....widgets import MinimumWidthWidget
from ....gui_common import GuiCommon

View file

@ -36,7 +36,7 @@ class CompressThread(QtCore.QThread):
# prepare files to share
def set_processed_size(self, x):
if self.mode._zip_progress_bar != None:
if self.mode._zip_progress_bar is not None:
self.mode._zip_progress_bar.update_processed_size_signal.emit(x)
def run(self):

View file

@ -19,12 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import random
import string
from PySide2 import QtCore, QtWidgets, QtGui
from onionshare_cli.onion import *
from onionshare_cli.common import Common
from onionshare_cli.web import Web
@ -32,7 +29,7 @@ from .. import Mode
from ..file_selection import FileSelection
from ..history import History, ToggleHistory
from .... import strings
from ....widgets import Alert, MinimumWidthWidget
from ....widgets import MinimumWidthWidget
from ....gui_common import GuiCommon

View file

@ -161,7 +161,7 @@ class ServerStatus(QtWidgets.QWidget):
self.url.setText(wrapped_onion_url)
else:
self.url.setText(self.get_url())
except:
except Exception:
pass
def show_url(self):

View file

@ -252,7 +252,7 @@ class EventHandlerThread(QtCore.QThread):
"EventHandler", "run", f"invalid event type: {obj}"
)
except:
except Exception:
pass
if self.should_quit:

View file

@ -166,7 +166,7 @@ class TorConnectionThread(QtCore.QThread):
else:
self.canceled_connecting_to_tor.emit()
except BundledTorCanceled as e:
except BundledTorCanceled:
self.common.log(
"TorConnectionThread", "run", "caught exception: BundledTorCanceled"
)

View file

@ -19,7 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from PySide2 import QtCore
import datetime, re
import datetime
import re
import socks
from distutils.version import LooseVersion as Version

View file

@ -25,7 +25,12 @@ version = "2.3.1"
setuptools.setup(
name="onionshare",
version=version,
description="OnionShare lets you securely and anonymously send and receive files. It works by starting a web server, making it accessible as a Tor onion service, and generating an unguessable web address so others can download files from you, or upload files to you. It does _not_ require setting up a separate server or using a third party file-sharing service.",
description=(
"OnionShare lets you securely and anonymously send and receive files. It works by starting a web "
"server, making it accessible as a Tor onion service, and generating an unguessable web address so "
"others can download files from you, or upload files to you. It does _not_ require setting up a "
"separate server or using a third party file-sharing service."
),
author="Micah Lee",
author_email="micah@micahflee.com",
maintainer="Micah Lee",