summaryrefslogtreecommitdiffstats
path: root/deluge/ui/client.py
Commit message (Collapse)AuthorAge
* [Tests] Transition tests to pure pytestChase Sterling2022-02-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Convert all the twisted.trial tests to pytest_twisted. Also move off of unittest.TestCase as well. Seems there were several tests which weren't actually testing what they should, and also some code that wasn't doing what the broken test said it should. Goals: Remove twisted.trial tests Move to pytest fixtures, rather than many classess and subclasses with setup and teardown functions Move away from self.assertX to assert style tests FIx broken tests Going forward I think these should be the goals when adding/modifying tests: * Don't use BaseTest or set_up tear_down methods any more. Fixtures should be used either in the test module/class, or make/improve the ones available in conftest.py * For sure don't use unittest or twisted.trial, they mess up the pytest stuff. * Prefer pytest_twisted.ensureDeferred with an async function over inlineCallbacks. - I think the async function syntax is nicer, and it helps catch silly mistakes, e.g. await None is invalid, but yield None isn't, so if some function returns an unexpected thing we try to await on, it will be caught earlier. (I struggled debugging a test for quite a while, then caught it immediately when switching to the new syntax) - Once the maybe_coroutine PR goes in, using the async syntax can also improve tracebacks when debugging tests. Things that should probably be cleaned up going forward: * Remove BaseTestCase * Remove the subclasses like DaemonBase in favor of new fixtures. * I think there are some other utility subclasses that could be removed too * Perhaps use parameterization in the ui_entry tests, rather that the weird combination of subclasses and the set_var fixture I mixed in. * Convert some of the callback stuff to pytest_twisted.ensureDeferred tests, just for nicer readability Details relating to pytest fixtures conftest.py in root dir: * https://github.com/pytest-dev/pytest/issues/5822#issuecomment-697331920 * https://docs.pytest.org/en/latest/deprecations.html#pytest-plugins-in-non-top-level-conftest-files Closes: https://github.com/deluge-torrent/deluge/pull/354
* Upgrade codebase with pyupgrade (>=py3.6)DjLegolas2021-12-29
| | | | | | | | Added pyupgrade utility with manual stage to pre-commit and run on all files. Ref: https://github.com/asottile/pyupgrade Closes: deluge-torrent/deluge#326
* Remove all Python 2 supportdeluge-2.1.0.dev0DjLegolas2021-12-28
| | | | | | | | | * Removed all __future__ imports from code * Removed all six dependencies * Removed all future_builtins imports * Removed all Python 2 related code Closes: deluge-torrent/deluge#325
* [Lint] Fix spelling mistakesCalum Lind2021-09-21
| | | | | | | A quick fix of some of the mistakes caught by codespell. Updated readme with new IRC server Useful to add it as part of linting checks.
* [UI] Fix passing bytes config path to subprocess on Python 3Calum Lind2018-11-02
| | | | | | The % substitution was causing the bytes prefix to become part of the string and created a `b'/` prefixed config directory. Ensure the config arg is byte prefixed too.
* [Lint] Use Black to auto-format codeCalum Lind2018-10-03
| | | | | | | | | | | | | | | | | The move to using auto-formatter makes it easier to read, submit and speeds up development time. https://github.com/ambv/black/ Although I would prefer 79 chars, the default line length of 88 chars used by black suffices. The flake8 line length remains at 120 chars since black does not touch comments or docstrings and this will require another round of fixes. The only black setting that is not standard is the use of double-quotes for strings so disabled any formatting of these. Note however that flake8 will still flag usage of double-quotes. I may change my mind on double vs single quotes but for now leave them. A new pyproject.toml file has been created for black configuration.
* [Py2to3] Fix log.warn deprecation warningCalum Lind2018-09-14
|
* Fix files to pass new Flake8 checkersCalum Lind2018-06-01
| | | | | | | | | | | 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.
* [UI] Further refactoring of the connection managersCalum Lind2017-06-07
| | | | | | | * Add host Edit button to WebUI. * Updated and fixed associated tests. * Refactored related gtkui code to better understand code flow. * Removed dead code in gtkui.
* [UI] Refactor duplicated code out of connection managersCalum Lind2017-06-07
|
* Replace/remove usage of dict.keys()Calum Lind2017-03-16
|
* [Py2to3] Large set of changes for Python 3 compatCalum Lind2017-03-16
| | | | | | | | | | | | - 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.
* [Py2to3] Force unicode_literals and fix related issuesCalum Lind2017-02-22
| | | | | | | | | | | | | | | | | | * 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.
* [Core] Decorate methods deprecatedCalum Lind2016-11-22
|
* [Lint] Fix files to pass Flake8 v3.2.0Calum Lind2016-11-17
|
* [Lint] Quote cleanupCalum Lind2016-11-17
|
* [Lint] Refactor flake8 noqa's and add msg numbersCalum Lind2016-11-04
| | | | | | From pep8-naming: * N802: function name should be lowercase * N803: argument name should be lowercase
* [Lint] Add flake8-quotes to tox and fix bad quotesCalum Lind2016-11-04
|
* [Lint] Convert all python double quotes to single quotesCalum Lind2016-11-03
| | | | | | | | | | | | | | | | | | * 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>`
* Rename classic to standaloneCalum Lind2016-11-02
|
* Revert "[Py2to3] Clean-up the use of keys() on dictionary objects."Calum Lind2016-10-26
| | | | This reverts commit 8b50f3cdbdec4f2fa622aca9d0e4b45e5e4bf3aa.
* [Py2to3] Clean-up the use of keys() on dictionary objects.Andrew Resch2016-10-26
| | | | | | | | 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.
* [UI] Reduce ui.client log verbositybendikro2016-05-24
|
* [WebUi] [Core] Fixes to plugin handling and WebUi plugin + testsbendikro2016-04-18
| | | | | | | | | | | | | | | This should fix problems with errors occuring when failing to enable plugins. Errors in plugin handling are handled better and properly logged. WebUI plugin in particular had issues when being enabled and disabled multiple times because it was trying to create DelugeWeb component each time it was enabled. If deluge-web is already listening on the same port, enabling the WebUI plugin will fail, and the checkbox will not be checked. There are still some issues when enabling/disabling plugins by clicking fast multiple times on the checkbox.
* [UI] Replace optparse with argparse for cmd arguments handlingbendikro2016-04-18
| | | | | optparse is deprecation and succeeded by argparse. See https://www.python.org/dev/peps/pep-0389
* [Tests] Improved common.start_corebendikro2016-04-10
| | | | | | | * Replace Popen with reactor.spawnProcess and read process output with twisted.internet.protocol.ProcessProtocol * Implement support for running custom script code * Now logs to stdout instead of stderr when not logging to file
* [Lint] Autopep8 aggressive runCalum Lind2015-11-04
| | | | | * Uses isinstance() instead of type() * Uses sorted() where possible
* [Lint] Cleanup code to pass PyLint Warning categoryCalum Lind2015-10-30
| | | | | | | | | | | | | | | | Selected Warning messages disabled in pylintrc: * unused-argument: Quite a large and disruptive change if enabled. * broad-except: Most required in-depth investigation to determine type. * fixme: Not important * protected-access: Complicated to fix * import-error: Too many false-positives * unidiomatic-typecheck: Should be fixed in the next round of checks. * unused-variable: Again large and disruptive changes. * global-statement: Most usage is required. * attribute-defined-outside-init: Should be fixed in next round of checks. * arguments-differ: Possible false-positives, needs revisited. * no-init, non-parent-init-called, super-init-not-called: False-positives? * signature-differs: False-positives?
* Flake8 codebaseCalum Lind2014-09-22
| | | | Fixes error E265 and E714 that have been added to newest version of pep8
* Flake8 pass of entire codebaseCalum Lind2014-09-19
| | | | * Use the inline '# NOQA' to supress N802 lower-case warnings
* Flake8 core and common filesCalum Lind2014-09-03
| | | | | | * 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
* Sort/prettify imports with isortCalum Lind2014-09-03
|
* [Python-Modernize] lib2to3.fixes.fix_exceptCalum Lind2014-09-03
| | | | | * Use 'ex' instead of 'e' to conform with pylint * Minimal Flake8 on some files
* Fix #2338 : Spelling mistake with occurredCalum Lind2013-06-09
|
* Fix bug introduced in 19234dbendikro2013-05-27
|
* Fix 2247: AttributeError in deluge.error.DaemonRunningErrorbendikro2013-05-26
| | | | | * Removed all the properties in error.py and added more tests * Handle failure in client.py handling RPC_ERROR (From older daemons)
* UI client.connect() with no credentials/username now attempts connect using ↵Calum Lind2013-05-16
| | | | localhost auth file details
* Make deluge-gtk get arguments as unicode.Chase Sterling2012-12-10
| | | | | Fix a few places that use those arguments. Make sure gtkui loads strings as unicode from rencode.
* Replace subprocess.call with subprocess.Popen to start deluged from gtk clientCalum Lind2012-11-30
| | | | | The use of Popen was originally a fix for a Win32 issue on 1.3 but makes sense to apply to all OSs and simplify code.
* Fix daemon starting with config dir containing spaces on Windows.Chase Sterling2012-11-09
|
* Fix #2185: register call should be deregister in deregister_event_handlerCalum Lind2012-10-14
|
* Added a protocol for the network traffic between client and daemon.bendikro2012-07-02
| | | | | | Implemented a protocol layer above twisted.internet.protocol.Protocol which guarantees correct transfer of RPC messages. The network messages are transfered with a header containing the length of the message.
* Cleaner log entry if deluged missingCalum Lind2012-02-23
|
* Fix #1945 : Mutable default arguments in deluge.ui.clientCalum Lind2011-11-29
|
* Wrap non deluge exceptions so that they can also be sent to the client.Pedro Algarvio2011-06-05
|
* Fix up stopping classic modeAndrew Resch2011-06-02
|
* Some comment explanation.Pedro Algarvio2011-05-19
|
* Extend RPC Protocol.Pedro Algarvio2011-05-18
| | | | While adding the multiuser auth related stuff, RPC_AUTH_EVENT was added, simply to not touch how RPC_ERROR was handled. It was created to allow recreating the exception on the client side. Instead of adding another rpc event type, extend RPC_ERROR to send the proper data to recreate the exception on the client side.
* Fix #1281. Show a nice dialog stating that the client is incompatible on the ↵Pedro Algarvio2011-05-17
| | | | GTK UI.
* Force backwards incompatibility.Pedro Algarvio2011-05-15
| | | | Force clients prior to 1.4 to fail authentication, this was we might reduce tickets like #1852.