49 Commits

Author SHA1 Message Date
Calum Lind
af7e83bc76 Replace/remove usage of dict.keys() 2017-03-16 23:20:56 +00:00
Calum Lind
84802da29b [Py2to3] Force unicode_literals and fix related issues
* Added `from __future__ import unicode_literals` to every file so
   now all strings in code are forced to be unicode strings unless
   marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`.

   This is a large change but we have been working towards the goal of unicode
   strings passed in the code so decoding external input and encoding
   output as byte strings (where applicable).

   Note that in Python 2 the `str` type still refers to byte strings.

 * Replaced the use of `str` for `basestring` in isinstance comparison as
   this was the original intention but breaks code when encoutering unicode strings.

 * Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly
   related to gobject signal names.
2017-02-22 12:36:32 +00:00
Calum Lind
2657cc3921 [Lint] Quote cleanup 2016-11-17 10:19:59 +00:00
Calum Lind
3a2ff0c188 [Lint] Convert all python double quotes to single quotes
* A rather disruptive change but for a few reasons such as easier to read,
   easier type, keep consistent and javascript code uses single quotes.
 * There are a few exceptions for the automated process:
    * Any double quotes in comments
    * Triple double quotes for docstrings
    * Strings containing single quotes are left e.g. "they're"

 * To deal with merge conflicts from feature branches it is best to follow
   these steps for each commit:
     * Create a patch: `git format-patch -1 <sha1>`
     * Edit the patch and replace double quotes with single except those in
       comments or strings containing an unescaped apostrophe.
     * Check the patch `git apply --check <patchfile>` and fix any remaining
       issues if it outputs an error.
     * Apply the patch `git am < <patchfile>`
2016-11-03 21:45:45 +00:00
Calum Lind
3f72905b3f Revert "[Py2to3] Clean-up the use of keys() on dictionary objects."
This reverts commit 8b50f3cdbdec4f2fa622aca9d0e4b45e5e4bf3aa.
2016-10-26 19:14:10 +01:00
Andrew Resch
8b50f3cdbd [Py2to3] Clean-up the use of keys() on dictionary objects.
To make the code more Python 3 compatible, I've made a few changes to how we handle keys() or iterkeys() calls on dictionaries. All functionality should remain the same.

 * Remove the use of .keys() or .iterkeys() when iterating through a dictionary.
 * Remove the use of .keys() when checking if key exists in dictionary.
 * Replace dict.keys() with list(dict) to obtain a list of dictionary keys. In Python 3 dict.keys() returns a dict_keys object, not a list.
2016-10-26 09:53:32 +01:00
Calum Lind
9dd3b1617d [#2889] Fixes for 'Too many files open' error
* Ensure all file descriptors are closed. Using the with statement ensures
   closure.
 * The main problem was with thousands of unclosed file desciptors from
   tracker_icons mkstemp.
 * Use a prefix 'deluge_ticon.' to identify created tracker_icon tmp files.
2016-10-18 18:40:25 +01:00
bendikro
7b54a2a1ee [UI] Replace optparse with argparse for cmd arguments handling
optparse is deprecation and succeeded by argparse. See
https://www.python.org/dev/peps/pep-0389
2016-04-18 00:53:37 +02:00
Calum Lind
2583e9d888 [Lint] Code cleanup for PyLint run by prospector tool
* Fix for pluginmanager multiple inheritance which in this case is using super incorrectly.
 * Explicitly disable pylint 'pointless-except' and 'super-on-old-class' that prospector
   tool somehow runs.
 * Make __all__ a tuple to supress pep257 warning.
 * Add a noqa for older versions of pyflakes.
2015-10-30 18:39:57 +00:00
Calum Lind
f2d81ff542 Update headers and isort imports 2014-09-23 08:39:29 +01:00
Calum Lind
142e96b246 Autopep8 E265 2014-09-22 12:46:17 +01:00
Calum Lind
30a0f3c9ed Flake8 pass of entire codebase
* Use the inline '# NOQA' to supress N802 lower-case warnings
2014-09-19 19:10:14 +01:00
Calum Lind
5167e93d12 Flake8 core and common files
* Added N802 to flake8 ignore as certain inherited funcs cannot be changed
   to lowercase and this unresolved warning hides other errors/warnings.
 * Include new header
2014-09-03 23:48:34 +01:00
Calum Lind
b5dcfc6f9e Sort/prettify imports with isort 2014-09-03 18:27:32 +01:00
Calum Lind
38bc5d07f0 [Python-Modernize] lib2to3.fixes.fix_ws_comma
* Fixer that changes 'a ,b' into 'a, b'.
2014-09-03 17:22:38 +01:00
Calum Lind
3a53f4002a [Python-Modernize] libmodernize.fixes.fix_print
* Replaces print with print()
2014-09-03 17:22:38 +01:00
Calum Lind
e43e4e2ee0 Fix 2107 : create_plugin.py call correct version of python 2012-11-06 22:24:40 +00:00
Pedro Algarvio
13db148a11 Now that the plugin's namespace is in use, make the plugins get their own logger instead of using getPluginLogger() 2011-06-03 23:10:43 +01:00
Pedro Algarvio
c00391a852 Merge branch 'master' into plugins-namespace 2010-12-28 01:45:50 +00:00
Pedro Algarvio
c164013725 Ported Feeder(although not working on current deluge), Notifications, Scheduler, Stats, Toggle and WebUi to the deluge.plugins namespace. 2010-12-10 04:31:51 +00:00
Pedro Algarvio
4c3d068f0c Improve create_plugin.py and the generated create_dev_link.sh. 2010-12-10 04:08:36 +00:00
Pedro Algarvio
e43146a4ac Simplify some code on create_plugin.py. 2010-12-10 03:25:39 +00:00
Pedro Algarvio
1c2eb0c737 Improve and port the create_plugin.py script to generate the plugins under the "deluge.plugins" namespace.
Any plugin not using the "deluge.plugins" namespace will get a `DeprecationWarning` printed on the console.
2010-12-10 03:15:36 +00:00
Pedro Algarvio
3b00a7de59 Swhiched the old style logging, ie, a single logger for all logging output to several loggers. This brings the ability to tweak the logging levels for each of the loggers, ie, we can have the "deluge" logger be at the ERROR level while having "deluge.core" at the DEBUG level, meaning we will only see log message for all of the deluge loggers above the ERROR level while still having all messages above the DEBUG level for the "deluge.core" logger and it's children. This kind of tweak can be achieved by adding a file named "logging.conf" to deluge's config dir and this is explained on the deluge.log.tweak_logging_levels function.
Passing `-r` to the cli's while also passing `-l` will make the logfile rotate when reaching 5Mb in size. Three backups will be kept at all times.
All deluge's code is now using this new style logging along with the git hosted plugins. For other plugins not hosted by deluge, which still imports `LOG` as the logger, a deprecation warning will be shown explaining the required changes needed to use the new style logging. New plugins created by the `create_plugin` script will use the new logging facilities.
2010-12-06 11:20:22 +00:00
Andrew Resch
fdc7d3d7fc Fix #1098 use triple quotes in the docstrings of the generated methods 2010-04-11 11:24:45 -07:00
Damien Churchill
f7f928f0b9 fix the entry point for web plugins 2010-03-10 10:39:20 +00:00
John Garland
cbac2fbd5a Fix typo. Remove obselete function. 2010-01-14 12:32:04 +00:00
Andrew Resch
c068384845 Fix create_plugin.py script 2009-10-24 05:51:26 +00:00
Damien Churchill
2d10f88714 add the missing s to %(filename)s 2009-10-01 10:40:48 +00:00
Damien Churchill
3d83dab4a1 add a GPL copyright header to the javascript plugin template 2009-10-01 10:39:09 +00:00
Damien Churchill
3901f3e6b2 update the create_plugin script allowing for the new webui plugin stuff 2009-09-17 07:36:13 +00:00
Damien Churchill
4cfa6485d7 remove the paranthesis from the decorators in core.py 2009-08-03 11:46:49 +00:00
Andrew Resch
c4782e91f0 Update create_plugin script a bit 2009-06-02 00:57:04 +00:00
Andrew Resch
d67477f6e2 Add OpenSSL exception to all GPL headers 2009-05-18 21:51:49 +00:00
Andrew Resch
9a94b3719d Some changes to the create_plugin script to work properly with 1.2 2009-05-02 02:11:36 +00:00
Andrew Resch
3a558433b9 Fix plugin __init__'s and update create_plugin script 2009-03-23 21:03:43 +00:00
Damien Churchill
fe002092bf apply Ghents patch to allow for specifying your deluge config dir whilst
creating a plugin
2009-03-06 17:18:48 +00:00
Andrew Resch
d4bc535027 Remove ssl exception from license header when creating plugins from the
script
2009-03-05 23:57:48 +00:00
Andrew Resch
4a6ecde07b Update create_plugin.py script 2009-02-24 00:00:35 +00:00
John Garland
d727a515b7 Updated for new year 2009-01-26 05:06:08 +00:00
Andrew Resch
c6ddaeaac7 Remove OpenSSL exception from license headers 2008-11-23 04:58:01 +00:00
Martijn Voncken
a311bcbcec config fixes 2008-11-06 19:12:11 +00:00
Andrew Resch
ac9959a92b Convert plugins setup.py to new format
Update create_plugin script to use new setup.py format
2008-10-27 03:53:21 +00:00
Martijn Voncken
335c50ec03 #483 2008-09-23 19:48:08 +00:00
Martijn Voncken
8a00b046d5 update create_plugin 2008-09-23 18:29:55 +00:00
Martijn Voncken
886939d64d gpl fix 2008-08-09 12:57:19 +00:00
Martijn Voncken
3928180cc9 bash fix 2008-08-09 12:49:02 +00:00
Martijn Voncken
6dbbb254e2 minor fixes 2008-08-09 08:12:22 +00:00
Martijn Voncken
60479e9fef create plugin script 2008-08-08 23:56:07 +00:00