diff options
author | Calum Lind <calumlind@gmail.com> | 2018-10-02 15:39:51 +0100 |
---|---|---|
committer | Calum Lind <calumlind@gmail.com> | 2018-10-03 15:21:53 +0100 |
commit | b1cdc32f7357e9777eb6cc2d90094c7d122af2eb (patch) | |
tree | 9106ac399a7df178c8dbed6fe58009d36b18159a /deluge/ui/console/cmdline/commands/rm.py | |
parent | bcca07443ccad7f130444baaac52b7b49478905e (diff) | |
download | deluge-b1cdc32f7357e9777eb6cc2d90094c7d122af2eb.tar.gz deluge-b1cdc32f7357e9777eb6cc2d90094c7d122af2eb.tar.bz2 deluge-b1cdc32f7357e9777eb6cc2d90094c7d122af2eb.zip |
[Lint] Use Black to auto-format 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.
Diffstat (limited to 'deluge/ui/console/cmdline/commands/rm.py')
-rw-r--r-- | deluge/ui/console/cmdline/commands/rm.py | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/deluge/ui/console/cmdline/commands/rm.py b/deluge/ui/console/cmdline/commands/rm.py index a2d431c4d..ff3125d81 100644 --- a/deluge/ui/console/cmdline/commands/rm.py +++ b/deluge/ui/console/cmdline/commands/rm.py @@ -22,33 +22,50 @@ log = logging.getLogger(__name__) class Command(BaseCommand): """Remove a torrent""" + aliases = ['del'] def add_arguments(self, parser): parser.add_argument( - '--remove_data', action='store_true', default=False, + '--remove_data', + action='store_true', + default=False, help=_('Also removes the torrent data'), ) parser.add_argument( - '-c', '--confirm', action='store_true', default=False, + '-c', + '--confirm', + action='store_true', + default=False, help=_('List the matching torrents without removing.'), ) - parser.add_argument('torrent_ids', metavar='<torrent-id>', nargs='+', help=_('One or more torrent ids')) + parser.add_argument( + 'torrent_ids', + metavar='<torrent-id>', + nargs='+', + help=_('One or more torrent ids'), + ) def handle(self, options): self.console = component.get('ConsoleUI') torrent_ids = self.console.match_torrents(options.torrent_ids) if not options.confirm: - self.console.write('{!info!}%d %s %s{!info!}' % ( - len(torrent_ids), - _n('torrent', 'torrents', len(torrent_ids)), - _n('match', 'matches', len(torrent_ids)), - )) + self.console.write( + '{!info!}%d %s %s{!info!}' + % ( + len(torrent_ids), + _n('torrent', 'torrents', len(torrent_ids)), + _n('match', 'matches', len(torrent_ids)), + ) + ) for t_id in torrent_ids: name = self.console.get_torrent_name(t_id) self.console.write('* %-50s (%s)' % (name, t_id)) - self.console.write(_('Confirm with -c to remove the listed torrents (Count: %d)') % len(torrent_ids)) + self.console.write( + _('Confirm with -c to remove the listed torrents (Count: %d)') + % len(torrent_ids) + ) return def on_removed_finished(errors): |