From bad09b551930e4c5156dbb4fe218dc1a57078bb9 Mon Sep 17 00:00:00 2001 From: Kevin Xiwei Zheng Date: Fri, 25 Mar 2016 23:17:10 -0700 Subject: [PATCH] Fix some lint errors --- omnipresence/compat.py | 3 +++ omnipresence/connection.py | 4 ++-- omnipresence/plugins/dice/test_dice.py | 1 - omnipresence/plugins/google/test_google.py | 1 - omnipresence/plugins/more/test_more.py | 2 +- omnipresence/plugins/url/test_url.py | 12 ++++++------ omnipresence/service.py | 1 - 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/omnipresence/compat.py b/omnipresence/compat.py index 4fad539..fbb17e7 100644 --- a/omnipresence/compat.py +++ b/omnipresence/compat.py @@ -34,3 +34,6 @@ def length_hint(obj, default=0): if hint < 0: raise ValueError("__length_hint__() should return >= 0") return hint + + +__all__ = ['length_hint'] diff --git a/omnipresence/connection.py b/omnipresence/connection.py index 738105b..7a893df 100644 --- a/omnipresence/connection.py +++ b/omnipresence/connection.py @@ -582,7 +582,7 @@ def _lineReceived(self, line): # Twisted doesn't like it when `lineReceived` returns a value, # but we need to do so for some unit tests. deferred = self.respond_to(Message.from_raw(self, False, line)) - super(ConnectionBase, self).lineReceived(line) + super(Connection, self).lineReceived(line) return deferred def lineReceived(self, line): @@ -593,7 +593,7 @@ def sendLine(self, line): """Overrides `.IRCClient.sendLine`.""" deferred = self.respond_to(Message.from_raw( self, True, line, actor=self.nickname)) - super(ConnectionBase, self).sendLine(line) + super(Connection, self).sendLine(line) return deferred diff --git a/omnipresence/plugins/dice/test_dice.py b/omnipresence/plugins/dice/test_dice.py index 65d3b30..ce789e5 100644 --- a/omnipresence/plugins/dice/test_dice.py +++ b/omnipresence/plugins/dice/test_dice.py @@ -5,7 +5,6 @@ from twisted.internet.defer import inlineCallbacks from twisted.trial.unittest import TestCase -from ...hostmask import Hostmask from ...message import Message, collapse from ...test.helpers import CommandTestMixin diff --git a/omnipresence/plugins/google/test_google.py b/omnipresence/plugins/google/test_google.py index 2ffe949..fc79eea 100644 --- a/omnipresence/plugins/google/test_google.py +++ b/omnipresence/plugins/google/test_google.py @@ -8,7 +8,6 @@ from ...compat import length_hint from ...message import collapse -from ...plugin import UserVisibleError from ...test.helpers import CommandTestMixin from . import Default diff --git a/omnipresence/plugins/more/test_more.py b/omnipresence/plugins/more/test_more.py index 340e169..cf03db2 100644 --- a/omnipresence/plugins/more/test_more.py +++ b/omnipresence/plugins/more/test_more.py @@ -6,7 +6,7 @@ from twisted.trial.unittest import TestCase -from ...message import Message, ReplyBuffer, collapse +from ...message import ReplyBuffer from ...settings import PRIVATE_CHANNEL from ...test.helpers import CommandTestMixin, OutgoingPlugin diff --git a/omnipresence/plugins/url/test_url.py b/omnipresence/plugins/url/test_url.py index 98128cf..602a4b6 100644 --- a/omnipresence/plugins/url/test_url.py +++ b/omnipresence/plugins/url/test_url.py @@ -11,7 +11,7 @@ class ExtractURLsTestCase(unittest.TestCase): # Most test cases are adapted from Django's urlize tests. def assert_urls(self, text, urls): - return list(extract_urls(text)) == urls + self.assertEqual(list(extract_urls(text)), urls) def test_http(self): self.assert_urls('http://example.com', ['http://example.com']) @@ -33,11 +33,11 @@ def test_word_with_dot(self): def test_parentheses(self): self.assert_urls('http://example.com/a_(b)', - ['http://example.com/a_(b)']) + ['http://example.com/a_(b)']) self.assert_urls('(http://example.com/a_(b))', - ['http://example.com/a_(b)']) + ['http://example.com/a_(b)']) self.assert_urls('(see http://example.com/a_(b))', - ['http://example.com/a_(b)']) + ['http://example.com/a_(b)']) def test_malformed(self): self.assert_urls('http:///example.com', []) @@ -49,14 +49,14 @@ def test_uppercase(self): def test_trailing_period(self): self.assert_urls('(Go to http://example.com/a.)', - ['http://example.com/a']) + ['http://example.com/a']) def test_ipv4(self): self.assert_urls('http://10.0.0.1/foo', ['http://10.0.0.1/foo']) def test_ipv6(self): self.assert_urls('http://[2001:db8:cafe::2]/foo', - ['http://[2001:db8:cafe::2]/foo']) + ['http://[2001:db8:cafe::2]/foo']) def test_catastrophic_backtracking(self): """Test that we don't crash on URLs that cause catastrophic diff --git a/omnipresence/service.py b/omnipresence/service.py index 941a230..6c1cf97 100644 --- a/omnipresence/service.py +++ b/omnipresence/service.py @@ -15,7 +15,6 @@ import yaml from .connection import ConnectionFactory -from .settings import ConnectionSettings def indent(string):