mirror of
https://github.com/logos-storage/deluge.git
synced 2026-01-07 15:43:10 +00:00
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.
32 lines
863 B
Python
32 lines
863 B
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright (C) 2009 Damien Churchill <damoxc@gmail.com>
|
|
#
|
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
|
# See LICENSE for more details.
|
|
#
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
from deluge.core.core import Core
|
|
from deluge.core.daemon import Daemon
|
|
|
|
|
|
class RpcApi(object):
|
|
pass
|
|
|
|
|
|
def scan_for_methods(obj):
|
|
methods = {'__doc__': 'Methods available in %s' % obj.__name__.lower()}
|
|
for d in dir(obj):
|
|
if not hasattr(getattr(obj, d), '_rpcserver_export'):
|
|
continue
|
|
methods[d] = getattr(obj, d)
|
|
cobj = type(obj.__name__.lower(), (object,), methods)
|
|
setattr(RpcApi, obj.__name__.lower(), cobj)
|
|
|
|
|
|
scan_for_methods(Core)
|
|
scan_for_methods(Daemon)
|