borg
borg copied to clipboard
use more py38 features
master branch requires py39+. 1.4-maint branch requires py39+. 1.2-maint branch requires py38+. 1.1-maint won't see any changes.
python 3.6 - https://docs.python.org/3/whatsnew/3.6.html
especially:
- [X] #5634
- [X] f-strings: https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-pep498
- [ ]
secretsmodule: https://docs.python.org/3/whatsnew/3.6.html#whatsnew36-pep506 - we could use that instead ofos.urandomat some places. maybe have a better readablerandom_bytesalias for thesecrets.token_bytesfunction? - scrypt maybe, additionally to the currently used pbkdf2? see #747.
- [x] https://docs.python.org/3/whatsnew/3.6.html#datetime - see the comment in
borg.constantsaboutisoformat()being evil - that's not the case any more with timespec != 'auto'! - https://docs.python.org/3/whatsnew/3.6.html#enum
- https://docs.python.org/3/whatsnew/3.6.html#time
- [ ] try https://docs.python.org/3/whatsnew/3.6.html#pythonmalloc-environment-variable - anything unusual/unexpected?
- [ ] try https://docs.python.org/3/whatsnew/3.6.html#tracemalloc - anything unusual/unexpected?
python 3.7 - https://docs.python.org/3/whatsnew/3.7.html
- [ ] data classes: https://docs.python.org/3/whatsnew/3.7.html#dataclasses (but also check hynek's
attrs) - [x] https://docs.python.org/3/library/datetime.html#datetime.datetime.fromisoformat - see
borg.helpers.time.parse_timestamp- needs more testing - [X] https://docs.python.org/3/library/hmac.html#hmac.digest - see #6408
- [X] https://docs.python.org/3/library/os.html#os.scandir can use a FD now - we already use that, we could just remove the
py_37_pluscheck.
python 3.8 - https://docs.python.org/3/whatsnew/3.8.html
- https://docs.python.org/3/whatsnew/3.8.html#assignment-expressions
- https://docs.python.org/3/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging
- https://docs.python.org/3/whatsnew/3.8.html#tarfile pax by default
Consider pyupgrade as helper
https://pypi.org/project/pyupgrade/
# zsh
pyupgrade --py38-plus ./**/*.py
https://github.com/borgbackup/borg/pull/6382 < pyupgrade run.