summaryrefslogtreecommitdiffstats
path: root/deluge/component.py
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/component.py')
-rw-r--r--deluge/component.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/deluge/component.py b/deluge/component.py
index b7b7ab3e4..5646e8bd2 100644
--- a/deluge/component.py
+++ b/deluge/component.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010 Andrew Resch <andrewresch@gmail.com>
#
@@ -7,13 +6,10 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import traceback
from collections import defaultdict
-from six import string_types
from twisted.internet import reactor
from twisted.internet.defer import DeferredList, fail, maybeDeferred, succeed
from twisted.internet.task import LoopingCall, deferLater
@@ -27,13 +23,13 @@ class ComponentAlreadyRegistered(Exception):
class ComponentException(Exception):
def __init__(self, message, tb):
- super(ComponentException, self).__init__(message)
+ super().__init__(message)
self.message = message
self.tb = tb
def __str__(self):
- s = super(ComponentException, self).__str__()
- return '%s\n%s' % (s, ''.join(self.tb))
+ s = super().__str__()
+ return '{}\n{}'.format(s, ''.join(self.tb))
def __eq__(self, other):
if isinstance(other, self.__class__):
@@ -45,7 +41,7 @@ class ComponentException(Exception):
return not self.__eq__(other)
-class Component(object):
+class Component:
"""Component objects are singletons managed by the :class:`ComponentRegistry`.
When a new Component object is instantiated, it will be automatically
@@ -250,7 +246,7 @@ class Component(object):
pass
-class ComponentRegistry(object):
+class ComponentRegistry:
"""The ComponentRegistry holds a list of currently registered :class:`Component` objects.
It is used to manage the Components by starting, stopping, pausing and shutting them down.
@@ -325,7 +321,7 @@ class ComponentRegistry(object):
# Start all the components if names is empty
if not names:
names = list(self.components)
- elif isinstance(names, string_types):
+ elif isinstance(names, str):
names = [names]
def on_depends_started(result, name):
@@ -359,7 +355,7 @@ class ComponentRegistry(object):
"""
if not names:
names = list(self.components)
- elif isinstance(names, string_types):
+ elif isinstance(names, str):
names = [names]
def on_dependents_stopped(result, name):
@@ -399,7 +395,7 @@ class ComponentRegistry(object):
"""
if not names:
names = list(self.components)
- elif isinstance(names, string_types):
+ elif isinstance(names, str):
names = [names]
deferreds = []
@@ -425,7 +421,7 @@ class ComponentRegistry(object):
"""
if not names:
names = list(self.components)
- elif isinstance(names, string_types):
+ elif isinstance(names, str):
names = [names]
deferreds = []