From 087102bde4ba857b261da269855151ae4beda3a1 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Tue, 18 Nov 2014 18:59:48 +0100 Subject: [PATCH] pep8: too long lines, reformat lines to < 120 chars. removed redundancy from long_description in setup.py. note: pep8 usually recommends 80 chars, but I find that impractical and unnecessary - it's not 1980 any more when code was edited on 80x25 terminals. i was a bit wondering about onionshare-launcher.py - it does a lot of imports, but does not use the imported names. --- onionshare/onionshare.py | 6 ++++-- onionshare_gui/file_selection.py | 6 ++++-- setup.py | 16 ++++++++++++++-- setup/onionshare-launcher.py | 4 +++- test/onionshare_helpers_test.py | 3 ++- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index 28744d2c..d7f13fb8 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -212,7 +212,8 @@ def tails_root(): sys.exit(-1) # open hole in firewall - subprocess.call(['/sbin/iptables', '-I', 'OUTPUT', '-o', 'lo', '-p', 'tcp', '--dport', str(port), '-j', 'ACCEPT']) + subprocess.call(['/sbin/iptables', '-I', 'OUTPUT', '-o', 'lo', + '-p', 'tcp', '--dport', str(port), '-j', 'ACCEPT']) # start hidden service app = OnionShare() @@ -226,7 +227,8 @@ def tails_root(): import signal def handler(signum=None, frame=None): - subprocess.call(['/sbin/iptables', '-D', 'OUTPUT', '-o', 'lo', '-p', 'tcp', '--dport', str(port), '-j', 'ACCEPT']) + subprocess.call(['/sbin/iptables', '-D', 'OUTPUT', '-o', 'lo', + '-p', 'tcp', '--dport', str(port), '-j', 'ACCEPT']) sys.exit() for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT]: signal.signal(sig, handler) diff --git a/onionshare_gui/file_selection.py b/onionshare_gui/file_selection.py index e8901403..89d2e560 100644 --- a/onionshare_gui/file_selection.py +++ b/onionshare_gui/file_selection.py @@ -188,14 +188,16 @@ class FileSelection(QtGui.QVBoxLayout): self.file_list.update() def add_files(self): - filenames = QtGui.QFileDialog.getOpenFileNames(caption=strings._('gui_choose_files', True), options=QtGui.QFileDialog.ReadOnly) + filenames = QtGui.QFileDialog.getOpenFileNames( + caption=strings._('gui_choose_files', True), options=QtGui.QFileDialog.ReadOnly) if filenames: for filename in filenames: self.file_list.add_file(str(filename)) self.update() def add_dir(self): - filename = QtGui.QFileDialog.getExistingDirectory(caption=strings._('gui_choose_folder', True), options=QtGui.QFileDialog.ReadOnly) + filename = QtGui.QFileDialog.getExistingDirectory( + caption=strings._('gui_choose_folder', True), options=QtGui.QFileDialog.ReadOnly) if filename: self.file_list.add_file(str(filename)) self.update() diff --git a/setup.py b/setup.py index 1ef27ccc..6e797197 100644 --- a/setup.py +++ b/setup.py @@ -38,11 +38,23 @@ def file_list(path): version = open('version').read().strip() +description = ( + """OnionShare lets you securely and anonymously share a file of any size with someone. """ + """It works by starting a web server, making it accessible as a Tor hidden service, """ + """and generating an unguessable URL to access and download the file.""") + +long_description = description + " " + ( + """It doesn't require setting up a server on the internet somewhere or using a third """ + """party filesharing service. You host the file on your own computer and use a Tor """ + """hidden service to make it temporarily accessible over the internet. The other user """ + """just needs to use Tor Browser to download the file from you.""" +) + setup( name='onionshare', version=version, - description='OnionShare lets you securely and anonymously share a file of any size with someone. It works by starting a web server, making it accessible as a Tor hidden service, and generating an unguessable URL to access and download the file.', - long_description="""OnionShare lets you securely and anonymously share a file of any size with someone. It works by starting a web server, making it accessible as a Tor hidden service, and generating an unguessable URL to access and download the file. It doesn't require setting up a server on the internet somewhere or using a third party filesharing service. You host the file on your own computer and use a Tor hidden service to make it temporarily accessible over the internet. The other user just needs to use Tor Browser to download the file from you.""", + description=description, + long_description=long_description, author='Micah Lee', author_email='micah@micahflee.com', url='https://github.com/micahflee/onionshare', diff --git a/setup/onionshare-launcher.py b/setup/onionshare-launcher.py index fe3a4245..6a6a1627 100644 --- a/setup/onionshare-launcher.py +++ b/setup/onionshare-launcher.py @@ -18,7 +18,9 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ from __future__ import division -import os, sys, subprocess, time, hashlib, platform, json, locale, socket, argparse, Queue, inspect, base64, random, functools, logging, ctypes, hmac, shutil +import os, sys, subprocess, time, hashlib, platform, json, locale, socket +import argparse, Queue, inspect, base64, random, functools, logging, ctypes +import hmac, shutil from itertools import izip import stem, stem.control, flask from PyQt4 import QtCore, QtGui diff --git a/test/onionshare_helpers_test.py b/test/onionshare_helpers_test.py index 1c7c42d2..ab21b9e6 100644 --- a/test/onionshare_helpers_test.py +++ b/test/onionshare_helpers_test.py @@ -24,7 +24,8 @@ import test_helpers def test_get_platform_on_tails(): """get_platform() returns 'Tails' when hostname is 'amnesia'""" - helpers.platform.uname = lambda: ('Linux', 'amnesia', '3.14-1-amd64', '#1 SMP Debian 3.14.4-1 (2014-05-13)', 'x86_64', '') + helpers.platform.uname = lambda: ('Linux', 'amnesia', '3.14-1-amd64', + '#1 SMP Debian 3.14.4-1 (2014-05-13)', 'x86_64', '') assert helpers.get_platform() == 'Tails'