| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Just trying to clean up some of the more complicated callback logic.
Notable changes:
* The test was awaiting a DeferredList. By default that will eat
exceptions and just add them to the result list (including test
assertion exceptions.) Added fireOnOneErrback=True to make sure that
wasn't happening. * Moved the logic for multiple calls to await the
same response into torrentmanager from core, so no matter where the
prefetch is called from it will wait for the original call.
* Implemented the multiple calls with an explicit queue of waiting
callbacks, rather than a callback callback chain. * Moved to one inline
async function rather than split into a main and callback after alert
function.
* Added some more type hints to the stuff I changed.
Adjusted test since we are using prefetch as an async function now
we have to schedule the alert to come after we start awaiting the
prefetch call.
Closes: https://github.com/deluge-torrent/deluge/pull/368
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Temporary torrent files are not deleted by add_torrent_url. Not as big a
problem as with tracker icons pages but should be removed after use.
Fixed by updating the method to use async and a try..finally cleanup
block.
Perhaps could be refactored to not require temporary files and instead
store the downloaded torrent as object for passing to add_torrent_file.
Trac: https://dev.deluge-torrent.org/ticket/3167
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Standardize docstrings in core.py to google standard.
Remove type hints in docstrings in favor of the ones in method signatures.
Use function signature type hints in autodoc generated docs.
Change Deferred type hints to strings.
Older versions of twisted (<21.7) don't
support generic Deferred type hinting,
this prevents crashes on those versions.
Closes: https://github.com/deluge-torrent/deluge/pull/359
|
|
|
|
|
|
|
|
|
|
| |
Make logging functions synchronous.
They were not calling any async functions, and wrapping them in
maybe_coroutine caused reactor to be imported before gtkui could
install the gtk reactor.
Closes: https://github.com/deluge-torrent/deluge/pull/353
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Typing is broken with older versions of Twisted e.g. with v21.2
deluge/deluge/core/core.py", line 404, in Core
) -> defer.Deferred[str]:
TypeError: 'type' object is not subscriptable
Also it might not be compatible with Python 3.6 or 3.7 with use of
certain types such as dict rather than Dict
This reverts commit 4096cdfdfe4fc7e42746cedd868bd7d8fea99f23.
Ref: https://twistedmatrix.com/trac/ticket/9816
|
|
|
|
|
|
|
|
|
| |
Standardize docstrings in core.py to google standard.
Remove type hints in docstrings in favor of the ones in method signatures.
Use function signature type hints in autodoc generated docs.
Closes: https://github.com/deluge-torrent/deluge/pull/359
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Libtorrent now supports interface names instead of just IP address so
add new common functions to validate user input.
* Added is_interface that will verify if a libtorrent interface of name
or IP address.
* Added is_interface_name to verify that the name supplied is a valid
network interface name in the operating system.
On Windows sock.if_nameindex() is only supported on 3.8+ and does not
return a uuid (required by libtorrent) so use ifaddr package. Using git
commit version for ifaddr due to adapter name decode bug in v0.1.7.
On other OSes attempt to use stdlib and fallback to ifaddr if installed
otherwiser return True.
* Added tests for is_interface & is_interface_name
* Updated UIs with change from address to interface
* Updated is_ipv6 and is_ipv4 to used inet_pton; now supported on
Windows.
Ref: https://github.com/pydron/ifaddr/pull/32
Closes: https://github.com/deluge-torrent/deluge/pull/338
|
|
|
|
|
|
|
|
| |
When requesting all keys, get_torrents_status was missing plugin added keys
This commit brings the behavior in line with get_torrent_status, and deluge 1.3
Closes: https://dev.deluge-torrent.org/ticket/3357
Closes: https://github.com/deluge-torrent/deluge/pull/347
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A UnicodeDecodeError is raised in transfer module when attempting to
prefetch a magnet.
This is result of passing a Python dict containing text bytes and raw
bytes that cannot be decoded as utf-8 in rencode when recieving the
message. This could be handled in rencode by returning raw bytes if
decoding fails (perhaps with a strict mode?) however better to follow
convention of encoding raw bytes in base64 in API calls.
Fixed by retaining bencoding and encoding with base64 when sending
result.
Resolves: https://github.com/deluge-torrent/deluge/pull/334
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
Removed in libtorrent v2.0.0:
https://github.com/arvidn/libtorrent/commit/569d47c3914d1f4a8672b92166ee461b4ae33aef
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Returns a generated magnet uri from torrent info
|
|
|
|
|
|
|
|
| |
Users were complaining about logs being flooded with `Session status key not valid`
which was a result of the Stats plugin using the wrong status keys.
Fixed by changing to debug log level since not useful in warning level
if spamming.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fixed black hook requiring Py3.6 to installed locally. Will now assume
Py3.6+ in installed.
* Added isort traceback in pre-commit flake8 hook fails
* Updated versions of Black, Prettier and isort
* Keep Flake8 at 3.7.9 due to E402 issue: https://gitlab.com/pycqa/flake8/-/issues/638
* New pyproject config for isort v5 with fixes for Python 2 imports.
* Fixed travis config to run Python 3.6 for lint run. Replaced the
virtualenv with_system_site_packages config with Travis specific Python
config value so lint run doesn't attempt to append with_system_site_packages
to Python 3.6 command.
|
|
|
|
|
|
|
|
|
| |
- Use sphinxcontrib.spelling with custom wordlist.
- Skip the checking of the modules documents as they raise
false-positives.
- Add a setup.py spellcheck_docs command.
- Fix spelling and other issues.
- Add a doc favicon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When adding magnets that have been prefetched the tracker details were
lost. A result of returning only the lt.torrent_info.metadata which
does not contain full torrent details, such as trackers.
- Modified torrentmanager prefetch_metadata to return dict instead of
base64 encoded bencoded metadata dict...
- Used a namedtuple to ease identifying tuple contents.
- Updated tests to reflect changes with mock trackers added to
test_torrent.file.torrent.
- Refactor TorrentInfo to accept dict instead of bytes and add
a class method to accept metadata dict with lists of trackers.
- Rename class arg from metainfo to torrent_file, matching
lt.torrent_info.
- Rename metadata property to correct name; metainfo.
- Simplify class variable naming with _filedata and _metainfo for
torrent file contents encoded and decoded respectively.
- Update GTK Add torrent dialog to pass trackers to TorrentInfo.
|
| |
|
|
|
|
|
|
| |
- Use six to silence flake8 undefined Python 2 names on Python 3.
- Fix W605 invalid escape sequence.
- Cleanup unused exception variables.
|
|
|
|
|
|
| |
- Remove is_ip check as libtorrent does accept IP address for this setting.
See: https://github.com/arvidn/libtorrent/issues/3087
- Use consistent wording for help text.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
A mistake in refactoring meant that listen_interface was reset to None
on shutdown.
|
|
|
|
|
|
|
|
|
| |
Simplify the methods by initialising the session_status dict using
libtorrent session_stats_metrics and rate keys.
Instead of first looking for deprecated keys use exception then lookup.
Added a few more tests.
|
| |
|
|
|
|
|
|
|
| |
- Disable the magnet from being auto_managed so it starts immediately.
- Reduce the default timeout to 30secs.
- Use the generic tempfile dir.
- Move callback method to be class method
|
| |
|
|
|
|
| |
If the torrent_id argument received in the pause or resume methods is not a string, the methods execute with the un-parsed input and then with parsed input on a second call. A key error exception is thrown from the first call, and the second call succeeds.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following error occured on Windows when switching to using HTTPS
url with Twisted Agent:
```
<class 'twisted.web._newclient.ResponseNeverReceived'>: [<twisted.python.failure.Failure OpenSSL.SSL.Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]>
```
The fix is to install certifi and provide the path to the trust store as
env var for OpenSSL to pick up.
Also includes a simplication of the core test_listen_port code.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
The usual minor fixes for unicode/bytes for library calls.
The minimum Twisted version is now 16 for Python 3 support so remove old
code and start replacing deprecated methods.
Raised the minimum TLS version to 1.2 for the web server.
|
| |
|
|
|
|
|
|
| |
* In Py3 base64.encodestring is deprecated so rather than use the
Py3 only encodebytes instead use b64encode. The other advantage is
that with issue a consistent TypeError is raised that we can catch.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was a misunderstand about outgoing interface setting in libtorrent
and instead of being able to take both IP and adapater names, it only
accepts adapter names and errors with an IP address, which was the
default of '0.0.0.0' in code.
This fixes the code to not accept IP address and use empty string if it
is given one.
Also includes a bit of code cleanup.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
The associated ticket made us aware that the id '-DE2000-' might be
blocked.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The synchonous add torrent method was replaced with async but this
break backward compatibility with 3rd party plugins and clients.
Added a new add_torrent_file_async method for adding single torrent.
Torrent manager has a new add_async method and split up code to prevent
duplication.
Update any use of add_torrent_file to add_torrent_file_async. Future
refactoring could use add_torrent_files instead.
|
| |
|
|
|
|
|
|
| |
* The verfication of timestamps of files on disc against those in resume data
can be buggy and sends torrents to error state for no apparent reason. It has
also been removed in latest version of libtorrent so disabling this check.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
|
|
|
|
|
|
|
|
|
| |
- Python 3 renames `unicode` type to `str` and introduces `bytes` type.
- Python 2.7 has `bytes` but is only an alias for `str` so restricted
to comparisons but helps keep compatibility.
- To test for unicode string on Py2 and Py3 uses the "''.__class__" type.
- Remove usage of utf8encode and just encode, problems with bytes being passed
in code will be picked up faster.
- Where possible refactor out isinstance for try..except duck-typing.
|
|
|
|
|
|
|
| |
* Twisted methods require byte-string arguments.
* The headers str conversion in httpdownloader _download_file was
incorrent and left the dict key still as unicode so replaced with
a dict comprehension (py2.7 requirement).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|