mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-27 03:36:16 +00:00
Add dependecy on six
This commit is contained in:
parent
4247013446
commit
200e8f552b
@ -41,7 +41,6 @@ version as this will be done internally.
|
|||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import cPickle as pickle
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -49,6 +48,8 @@ import shutil
|
|||||||
from codecs import getwriter
|
from codecs import getwriter
|
||||||
from io import open
|
from io import open
|
||||||
|
|
||||||
|
import six.moves.cPickle as pickle
|
||||||
|
|
||||||
from deluge.common import JSON_FORMAT, get_default_config_dir
|
from deluge.common import JSON_FORMAT, get_default_config_dir
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
"""TorrentManager handles Torrent objects"""
|
"""TorrentManager handles Torrent objects"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import cPickle as pickle
|
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
import operator
|
import operator
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import six.moves.cPickle as pickle
|
||||||
from twisted.internet import defer, error, reactor, threads
|
from twisted.internet import defer, error, reactor, threads
|
||||||
from twisted.internet.defer import Deferred, DeferredList
|
from twisted.internet.defer import Deferred, DeferredList
|
||||||
from twisted.internet.task import LoopingCall
|
from twisted.internet.task import LoopingCall
|
||||||
|
@ -16,6 +16,8 @@ and subsequently emitted to the clients.
|
|||||||
"""
|
"""
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import six
|
||||||
|
|
||||||
known_events = {}
|
known_events = {}
|
||||||
|
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ class DelugeEventMetaClass(type):
|
|||||||
known_events[name] = cls
|
known_events[name] = cls
|
||||||
|
|
||||||
|
|
||||||
class DelugeEvent(object):
|
class DelugeEvent(six.with_metaclass(DelugeEventMetaClass, object)):
|
||||||
"""
|
"""
|
||||||
The base class for all events.
|
The base class for all events.
|
||||||
|
|
||||||
@ -39,7 +41,6 @@ class DelugeEvent(object):
|
|||||||
:type args: list
|
:type args: list
|
||||||
|
|
||||||
"""
|
"""
|
||||||
__metaclass__ = DelugeEventMetaClass
|
|
||||||
|
|
||||||
def _get_name(self):
|
def _get_name(self):
|
||||||
return self.__class__.__name__
|
return self.__class__.__name__
|
||||||
|
@ -18,6 +18,7 @@ import os.path
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from sys import exc_info
|
from sys import exc_info
|
||||||
|
|
||||||
|
import six
|
||||||
from pkg_resources import resource_filename
|
from pkg_resources import resource_filename
|
||||||
|
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ def raises_errors_as(error):
|
|||||||
return func(self, *args, **kwargs)
|
return func(self, *args, **kwargs)
|
||||||
except Exception:
|
except Exception:
|
||||||
(value, tb) = exc_info()[1:]
|
(value, tb) = exc_info()[1:]
|
||||||
raise error, value, tb
|
six.reraise(error, value, tb)
|
||||||
return wrapper
|
return wrapper
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import cPickle as pickle
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import six.moves.cPickle as pickle
|
||||||
from gobject import GError
|
from gobject import GError
|
||||||
from gtk import SORT_ASCENDING, Menu, MenuItem, RadioMenuItem, SeparatorMenuItem, clipboard_get, icon_theme_get_default
|
from gtk import SORT_ASCENDING, Menu, MenuItem, RadioMenuItem, SeparatorMenuItem, clipboard_get, icon_theme_get_default
|
||||||
from gtk.gdk import COLORSPACE_RGB, SELECTION_PRIMARY, Pixbuf, pixbuf_new_from_file, pixbuf_new_from_file_at_size
|
from gtk.gdk import COLORSPACE_RGB, SELECTION_PRIMARY, Pixbuf, pixbuf_new_from_file, pixbuf_new_from_file_at_size
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
|
|
||||||
from __future__ import division, unicode_literals
|
from __future__ import division, unicode_literals
|
||||||
|
|
||||||
import cPickle as pickle
|
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
|
import six.moves.cPickle as pickle
|
||||||
from gobject import TYPE_UINT64
|
from gobject import TYPE_UINT64
|
||||||
from gtk.gdk import ACTION_DEFAULT, ACTION_MOVE, BUTTON1_MASK, keyval_name # pylint: disable=ungrouped-imports
|
from gtk.gdk import ACTION_DEFAULT, ACTION_MOVE, BUTTON1_MASK, keyval_name # pylint: disable=ungrouped-imports
|
||||||
|
|
||||||
|
@ -9,13 +9,14 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import __builtin__
|
|
||||||
import gettext
|
import gettext
|
||||||
import locale
|
import locale
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from six.moves import builtins
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -28,8 +29,8 @@ def set_dummy_trans(warn_msg=None):
|
|||||||
if warn_msg:
|
if warn_msg:
|
||||||
log.warn('"%s" has been marked for translation, but translation is unavailable.', txt[0])
|
log.warn('"%s" has been marked for translation, but translation is unavailable.', txt[0])
|
||||||
return txt[0]
|
return txt[0]
|
||||||
__builtin__.__dict__['_'] = _func
|
builtins.__dict__['_'] = _func
|
||||||
__builtin__.__dict__['ngettext'] = __builtin__.__dict__['_n'] = _func
|
builtins.__dict__['ngettext'] = builtins.__dict__['_n'] = _func
|
||||||
|
|
||||||
|
|
||||||
def get_translations_path():
|
def get_translations_path():
|
||||||
@ -127,7 +128,7 @@ def setup_translations(setup_gettext=True, setup_pygtk=False):
|
|||||||
kwargs = {} if not deluge.common.PY2 else {'unicode': True}
|
kwargs = {} if not deluge.common.PY2 else {'unicode': True}
|
||||||
|
|
||||||
gettext.install(domain, translations_path, names='ngettext', **kwargs)
|
gettext.install(domain, translations_path, names='ngettext', **kwargs)
|
||||||
__builtin__.__dict__['_n'] = __builtin__.__dict__['ngettext']
|
builtins.__dict__['_n'] = builtins.__dict__['ngettext']
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.error('Unable to initialize gettext/locale!')
|
log.error('Unable to initialize gettext/locale!')
|
||||||
log.exception(ex)
|
log.exception(ex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user