| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
The hashlib update method requires bytes and raised a TypeError for salt
passed as text.
Added a test for auth change_password
Fixes: #3262
|
|
|
|
| |
Remove obsolete password check code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
| |
* For future parsing into other docstring styles.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>`
|
|
|
|
|
|
|
|
|
|
|
| |
* Merge in pylint 1.6.4 rcfile changes.
* Add future_builtins to redefined-builtins-modules ignore list. (should be pylint default!)
- Removed pylint disable comments from files.
* Rearrange disable section, comments must be at start of line but can be
interspersed to highlight categories.
* Conventions enabled:
wrong-import-position
wrong-import-order
|
|
|
|
| |
This reverts commit 8b50f3cdbdec4f2fa622aca9d0e4b45e5e4bf3aa.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
* Implement JSONTestCase in test_json_api.py
* Implement WebAPITestCase test case in test_web_api.py
|
| |
|
|
|
|
|
|
| |
* Replace weak hashing functions, key sizes, and random number
generation techniques with less weak versions to prevent
crashes when running with the fips module loaded.
|
|
|
|
|
| |
* Uses isinstance() instead of type()
* Uses sorted() where possible
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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?
|
| |
|
|
|
|
|
|
|
|
|
| |
* Further whitespace fixes by autopep8
* Using pep8 v1.6.2 (not currently used by pyflakes)
* Update config for pep8 and flake8 in tox.ini
* A separate pep8 entry for running autopep8. The ignores prevent
blank lines being added after docstrings.
* .tox and E133 are ignored in flake8 by default.
|
| |
|
|
|
|
| |
* Use the inline '# NOQA' to supress N802 lower-case warnings
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
| |
* Use 'ex' instead of 'e' to conform with pylint
* Minimal Flake8 on some files
|
|
|
|
| |
* Does not pass cleanly due to camelcase function names and __request__ global.
|
| |
|
|
|
|
|
| |
hashlib requires UTF-8 encoded string
Passes flake8 but with warning for global __request__
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
checking
move the password checking logic into a seperate check_password method
|
| |
|