35 Commits

Author SHA1 Message Date
Calum Lind
d642fa3989 Fix files to pass new Flake8 checkers
Some new flake8 checkers were added so fix these new warnings and
any issues uncovered.

Use add-trailing-comma to fix missing trailing commas. It does not
format it as well as I would like however it was fast to change and
helps with git changes in future.

Removed pylint from tox due to large number of warnings.
2018-06-01 23:41:17 +01:00
Calum Lind
8326206f87 Ensure configmanager config dir path is unicode 2017-06-08 11:25:11 +01:00
Calum Lind
a727ee67bc [Core] Ensure absolute dirpath for config dir 2017-03-29 21:22:33 +01:00
Calum Lind
eb38e0ffff [Py2to3] Large set of changes for Python 3 compat
- Preparation work for using six or future module for Py2/3 compat. The
   code will be written in Python 3 with Python 2 fallbacks.
 - Added some Py3 imports with Py2 fallbacks to make it easier to remove
   Py2 code in future.
 - Replace xrange with range (sort out import as top of files in future).
 - Workaround Py2to3 basestring issue with inline if in instances. This means
   every usage of basestring is more considered.
 - Replace iteritems and itervalues for items and values. There might be a
   performance penalty on Py2 so might need to revisit this change.
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
36cbfa8c61 [Lint] Fix files to pass Flake8 v3.2.0 2016-11-17 12:19:41 +00:00
Calum Lind
2657cc3921 [Lint] Quote cleanup 2016-11-17 10:19:59 +00:00
Calum Lind
e37c817151 [Lint] Refactor flake8 noqa's and add msg numbers
From pep8-naming:
 * N802: function name should be lowercase
 * N803: argument name should be lowercase
2016-11-04 18:03:21 +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
bendikro
4d3cf756e4 [#2914] Fix: Specifying file version for default config 2016-10-30 12:45:02 +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
bendikro
1a2ff9b089 [Lint] Fix and remove old-style-class from ignore warnings 2016-05-06 12:44:45 +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
1e6c811768 [Python-Modernize] lib2to3.fixes.fix_except
* Use 'ex' instead of 'e' to conform with pylint
 * Minimal Flake8 on some files
2014-09-03 17:22:38 +01:00
Pedro Algarvio
5841521133 Added missing import.
Removed log message that caused error. It was never logged anyway, even on the master branch before the improved logging branch was created.
2010-12-28 01:26:25 +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
abc3964f73 Reset the config_files when the config directory changes 2009-08-03 16:56:01 +00:00
Andrew Resch
d67477f6e2 Add OpenSSL exception to all GPL headers 2009-05-18 21:51:49 +00:00
Andrew Resch
df21107e3f Improvements to the new UI class and improve how ConfigManager handles
setting the config directory
2009-05-18 21:34:03 +00:00
Andrew Resch
90e05827dd Remove 5 minute config save timer as it's not really needed and it's
preventing gtkui from starting
2009-05-12 17:48:47 +00:00
Andrew Resch
0ab8fa4871 Remove gobject timer and replace with a twisted LoopingCall 2009-05-12 16:15:06 +00:00
Damien Churchill
2b4ca765fa move the config_directory attribute to a property that gets lazily set 2009-05-11 10:28:59 +00:00
Andrew Resch
37c3b4334c Add basic authentication -- your connectionmanager config will be cleared and this will likely break other UIs 2008-12-10 07:56:40 +00:00
Andrew Resch
c6ddaeaac7 Remove OpenSSL exception from license headers 2008-11-23 04:58:01 +00:00
Andrew Resch
a0bf6d8fe1 Remove trailing whitspace from *.py 2008-11-17 00:57:32 +00:00
Marcos Pinto
6fa31d1dc0 change copyright notices to gpl3 2008-08-08 05:59:07 +00:00
Andrew Resch
4c867264f9 Add '-c, --config' options to set config directory. 2008-04-05 22:40:35 +00:00
Andrew Resch
8f62df0732 Inital import of SystemTray 2007-09-22 23:02:58 +00:00
Andrew Resch
30ed1f2d86 Fix saving config on exit of UI. 2007-09-22 03:30:42 +00:00
Andrew Resch
cc155d9473 ConfigManager now tries to save configs every 5 minutes.
Added close() to ConfigManager to explicitly close and save a config.
2007-09-22 03:14:23 +00:00
Andrew Resch
e4ebef6ae3 Properly shutdown ConfigManager. 2007-09-18 04:47:28 +00:00
Andrew Resch
8f796738d5 Initial import of ConfigManager. 2007-09-17 12:44:31 +00:00