summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind@gmail.com>2018-10-31 11:31:50 +0000
committerCalum Lind <calumlind@gmail.com>2018-11-02 08:47:57 +0000
commit7d998a45f25eea9d650f9ec089c5f84a30527081 (patch)
treeee642cd0d5f2b34aa34a173dc1faa2230ac9adc5
parent3433a911ccd7192c37c3cdbcc8094d276a68c705 (diff)
downloaddeluge-7d998a45f25eea9d650f9ec089c5f84a30527081.tar.gz
deluge-7d998a45f25eea9d650f9ec089c5f84a30527081.tar.bz2
deluge-7d998a45f25eea9d650f9ec089c5f84a30527081.zip
Shorten code to declare namespace
This is the recommened way of declaring namespace. Also remove unneeded unicode_literals import.
-rw-r--r--deluge/__init__.py7
-rw-r--r--deluge/plugins/AutoAdd/deluge/__init__.py7
-rw-r--r--deluge/plugins/AutoAdd/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/Blocklist/deluge/__init__.py3
-rw-r--r--deluge/plugins/Blocklist/deluge/plugins/__init__.py3
-rw-r--r--deluge/plugins/Execute/deluge/__init__.py7
-rw-r--r--deluge/plugins/Execute/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/Extractor/deluge/__init__.py7
-rw-r--r--deluge/plugins/Extractor/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/Label/deluge/__init__.py7
-rw-r--r--deluge/plugins/Label/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/Notifications/deluge/__init__.py7
-rw-r--r--deluge/plugins/Notifications/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/Scheduler/deluge/__init__.py7
-rw-r--r--deluge/plugins/Scheduler/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/Stats/deluge/__init__.py7
-rw-r--r--deluge/plugins/Stats/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/Toggle/deluge/__init__.py7
-rw-r--r--deluge/plugins/Toggle/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/WebUi/deluge/__init__.py7
-rw-r--r--deluge/plugins/WebUi/deluge/plugins/__init__.py7
-rw-r--r--deluge/plugins/__init__.py7
-rw-r--r--deluge/scripts/create_plugin.py4
23 files changed, 21 insertions, 129 deletions
diff --git a/deluge/__init__.py b/deluge/__init__.py
index 6dd6930e2..3a58602bd 100644
--- a/deluge/__init__.py
+++ b/deluge/__init__.py
@@ -1,7 +1,2 @@
"""Deluge"""
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/AutoAdd/deluge/__init__.py b/deluge/plugins/AutoAdd/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/AutoAdd/deluge/__init__.py
+++ b/deluge/plugins/AutoAdd/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py
+++ b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Blocklist/deluge/__init__.py b/deluge/plugins/Blocklist/deluge/__init__.py
index c55970686..de40ea7ca 100644
--- a/deluge/plugins/Blocklist/deluge/__init__.py
+++ b/deluge/plugins/Blocklist/deluge/__init__.py
@@ -1,4 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Blocklist/deluge/plugins/__init__.py b/deluge/plugins/Blocklist/deluge/plugins/__init__.py
index c55970686..de40ea7ca 100644
--- a/deluge/plugins/Blocklist/deluge/plugins/__init__.py
+++ b/deluge/plugins/Blocklist/deluge/plugins/__init__.py
@@ -1,4 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Execute/deluge/__init__.py b/deluge/plugins/Execute/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Execute/deluge/__init__.py
+++ b/deluge/plugins/Execute/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Execute/deluge/plugins/__init__.py b/deluge/plugins/Execute/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Execute/deluge/plugins/__init__.py
+++ b/deluge/plugins/Execute/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Extractor/deluge/__init__.py b/deluge/plugins/Extractor/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Extractor/deluge/__init__.py
+++ b/deluge/plugins/Extractor/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Extractor/deluge/plugins/__init__.py b/deluge/plugins/Extractor/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Extractor/deluge/plugins/__init__.py
+++ b/deluge/plugins/Extractor/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Label/deluge/__init__.py b/deluge/plugins/Label/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Label/deluge/__init__.py
+++ b/deluge/plugins/Label/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Label/deluge/plugins/__init__.py b/deluge/plugins/Label/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Label/deluge/plugins/__init__.py
+++ b/deluge/plugins/Label/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Notifications/deluge/__init__.py b/deluge/plugins/Notifications/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Notifications/deluge/__init__.py
+++ b/deluge/plugins/Notifications/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Notifications/deluge/plugins/__init__.py b/deluge/plugins/Notifications/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Notifications/deluge/plugins/__init__.py
+++ b/deluge/plugins/Notifications/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Scheduler/deluge/__init__.py b/deluge/plugins/Scheduler/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Scheduler/deluge/__init__.py
+++ b/deluge/plugins/Scheduler/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Scheduler/deluge/plugins/__init__.py b/deluge/plugins/Scheduler/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Scheduler/deluge/plugins/__init__.py
+++ b/deluge/plugins/Scheduler/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Stats/deluge/__init__.py b/deluge/plugins/Stats/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Stats/deluge/__init__.py
+++ b/deluge/plugins/Stats/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Stats/deluge/plugins/__init__.py b/deluge/plugins/Stats/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Stats/deluge/plugins/__init__.py
+++ b/deluge/plugins/Stats/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Toggle/deluge/__init__.py b/deluge/plugins/Toggle/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Toggle/deluge/__init__.py
+++ b/deluge/plugins/Toggle/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/Toggle/deluge/plugins/__init__.py b/deluge/plugins/Toggle/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/Toggle/deluge/plugins/__init__.py
+++ b/deluge/plugins/Toggle/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/WebUi/deluge/__init__.py b/deluge/plugins/WebUi/deluge/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/WebUi/deluge/__init__.py
+++ b/deluge/plugins/WebUi/deluge/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/WebUi/deluge/plugins/__init__.py b/deluge/plugins/WebUi/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/WebUi/deluge/plugins/__init__.py
+++ b/deluge/plugins/WebUi/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/plugins/__init__.py b/deluge/plugins/__init__.py
index 46dd0ac34..de40ea7ca 100644
--- a/deluge/plugins/__init__.py
+++ b/deluge/plugins/__init__.py
@@ -1,6 +1 @@
-from __future__ import unicode_literals
-
-# this is a namespace package
-import pkg_resources
-
-pkg_resources.declare_namespace(__name__)
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py
index aa58e3425..638c036db 100644
--- a/deluge/scripts/create_plugin.py
+++ b/deluge/scripts/create_plugin.py
@@ -388,9 +388,7 @@ GPL = """#
"""
-NAMESPACE_INIT = """# this is a namespace package
-import pkg_resources
-pkg_resources.declare_namespace(__name__)
+NAMESPACE_INIT = """__import__('pkg_resources').declare_namespace(__name__)
"""
CREATE_DEV_LINK = """#!/bin/bash