From 0ee0f02626220c169cfe1a5b814b63cc07fc2263 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Thu, 31 Jul 2014 15:43:58 +0200 Subject: Made Python code PEP8 clean --- miniircd | 11 ++++++----- test | 1 + test.py | 7 +++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/miniircd b/miniircd index bfcc8fa..0eae9a8 100755 --- a/miniircd +++ b/miniircd @@ -33,6 +33,7 @@ import time from datetime import datetime from optparse import OptionParser + def create_directory(path): if not os.path.isdir(path): os.makedirs(path) @@ -731,7 +732,7 @@ class Server(object): client.channel_log(x, "quit (%s)" % quitmsg, meta=True) x.remove_client(client) if client.nickname \ - and irc_lower(client.nickname) in self.nicknames: + and irc_lower(client.nickname) in self.nicknames: del self.nicknames[irc_lower(client.nickname)] del self.clients[client.socket] @@ -766,7 +767,7 @@ class Server(object): (iwtd, owtd, ewtd) = select.select( serversockets + [x.socket for x in self.clients.values()], [x.socket for x in self.clients.values() - if x.write_queue_size() > 0], + if x.write_queue_size() > 0], [], 10) for x in iwtd: @@ -791,7 +792,7 @@ class Server(object): self.print_info("Accepted connection from %s:%s." % ( addr[0], addr[1])) for x in owtd: - if x in self.clients: # client may have been disconnected + if x in self.clients: # client may have been disconnected self.clients[x].socket_writable_notification() now = time.time() if last_aliveness_check + 10 < now: @@ -896,8 +897,8 @@ def main(argv): if (os.getuid() == 0 or os.getgid() == 0) and not options.setuid: op.error("Running this service as root is not recommended. Use the" " --setuid option to switch to an unprivileged account after" - " startup. If you really intend to run as root, use \"--setuid" - " root\".") + " startup. If you really intend to run as root, use" + " \"--setuid root\".") ports = [] for port in re.split(r"[,\s]+", options.ports): diff --git a/test b/test index af947ea..48fc3c7 100755 --- a/test +++ b/test @@ -3,4 +3,5 @@ set -e pyflakes miniircd test.py +pep8 miniircd test.py nosetests diff --git a/test.py b/test.py index 64734d8..4b1c3f7 100644 --- a/test.py +++ b/test.py @@ -11,6 +11,7 @@ from nose.tools import assert_not_in, assert_true SERVER_PORT = 16667 + class ServerFixture(object): def setUp(self, persistent=False): if persistent: @@ -22,7 +23,7 @@ class ServerFixture(object): # Child. arguments = [ "miniircd", -# "--debug", + # "--debug", "--ports=%d" % SERVER_PORT, ] if persistent: @@ -254,7 +255,9 @@ class TestBasicStuff(ServerFixture): def test_lusers(self): self.connect("apa") self.send("apa", "lusers") - self.expect("apa", r":local\S+ 251 apa :There are \d+ users and \d+ services on \d+ servers*") + self.expect("apa", + r":local\S+ 251 apa :There are \d+ users and \d+ services" + " on \d+ servers*") class TestTwoChannelsStuff(TwoClientsTwoChannelsFixture): -- cgit v1.2.3