From 17e389b80070ace755b28f3a77bdb4121f445417 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 18 Apr 2016 01:40:17 +0200 Subject: [PATCH] Improve pep8 conformance --- onionshare/helpers.py | 2 +- onionshare/onionshare.py | 2 +- onionshare/strings.py | 2 +- onionshare/web.py | 3 +-- test/onionshare_helpers_test.py | 2 -- test/onionshare_strings_test.py | 1 - test/onionshare_test.py | 1 - test/test_helpers.py | 5 ++--- 8 files changed, 6 insertions(+), 12 deletions(-) diff --git a/onionshare/helpers.py b/onionshare/helpers.py index ae58488a..30805384 100644 --- a/onionshare/helpers.py +++ b/onionshare/helpers.py @@ -17,7 +17,7 @@ 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 . """ -import sys, os, inspect, hashlib, base64, hmac, platform, zipfile, tempfile, math, time +import sys, os, inspect, hashlib, base64, platform, zipfile, tempfile, math, time from random import SystemRandom diff --git a/onionshare/onionshare.py b/onionshare/onionshare.py index 0ccf394e..f9c07868 100644 --- a/onionshare/onionshare.py +++ b/onionshare/onionshare.py @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import os, sys, subprocess, time, argparse, inspect, shutil, socket, threading +import os, sys, time, argparse, shutil, socket, threading from . import strings, helpers, web, hs diff --git a/onionshare/strings.py b/onionshare/strings.py index 61235e2b..116f115c 100644 --- a/onionshare/strings.py +++ b/onionshare/strings.py @@ -17,7 +17,7 @@ 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 . """ -import json, locale, sys, os +import json, locale, os from . import helpers diff --git a/onionshare/web.py b/onionshare/web.py index 6aba1c79..958e8c3a 100644 --- a/onionshare/web.py +++ b/onionshare/web.py @@ -20,7 +20,6 @@ along with this program. If not, see . import queue, mimetypes, platform, os, sys from urllib.request import urlopen from flask import Flask, Response, request, render_template_string, abort -from functools import wraps from . import strings, helpers @@ -231,7 +230,7 @@ def download(slug_candidate): # The user has canceled the download, so stop serving the file if client_cancel: add_request(REQUEST_CANCELED, path, {'id': download_id}) - break; + break chunk = fp.read(chunk_size) if chunk == b'': diff --git a/test/onionshare_helpers_test.py b/test/onionshare_helpers_test.py index b5c16ffe..d8e896c4 100644 --- a/test/onionshare_helpers_test.py +++ b/test/onionshare_helpers_test.py @@ -17,9 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ from onionshare import helpers -from nose import with_setup -import test_helpers def test_get_platform_returns_platform_system(): """get_platform() returns platform.system() when ONIONSHARE_PLATFORM is not defined""" diff --git a/test/onionshare_strings_test.py b/test/onionshare_strings_test.py index 250df28f..819c1e87 100644 --- a/test/onionshare_strings_test.py +++ b/test/onionshare_strings_test.py @@ -19,7 +19,6 @@ along with this program. If not, see . """ import locale from onionshare import strings -from nose import with_setup def test_starts_with_empty_strings(): diff --git a/test/onionshare_test.py b/test/onionshare_test.py index 20a00227..a0c77fa9 100644 --- a/test/onionshare_test.py +++ b/test/onionshare_test.py @@ -18,7 +18,6 @@ along with this program. If not, see . """ import socket from onionshare import OnionShare -from nose import with_setup def test_choose_port_returns_a_port_number(): diff --git a/test/test_helpers.py b/test/test_helpers.py index 2ddc1e13..b07021c5 100644 --- a/test/test_helpers.py +++ b/test/test_helpers.py @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ import tempfile +import os class MockSubprocess(): @@ -31,9 +32,7 @@ class MockSubprocess(): def write_tempfile(text): - tempdir = tempfile.mkdtemp() - path = tempdir + "/test-file.txt" + path = os.path.join(tempfile.mkdtemp(), "/test-file.txt") with open(path, "w") as f: f.write(text) - f.close() return path