Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyln-client: Remove category, description and long description from methods #7818

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions contrib/pyln-client/pyln/client/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,34 +474,24 @@ def get_option(self, name: str) -> Optional[Any]:
else:
return self.options[name].default

def async_method(self, method_name: str, category: Optional[str] = None,
desc: Optional[str] = None,
long_desc: Optional[str] = None,
def async_method(self, method_name: str,
deprecated: Optional[Union[bool, List[str]]] = None) -> NoneDecoratorType:
"""Decorator to add an async plugin method to the dispatch table.

Internally uses add_method.
"""
def decorator(f: Callable[..., None]) -> Callable[..., None]:
for attr, attr_name in [(category, "Category"), (desc, "Description"), (long_desc, "Long description")]:
if attr is not None:
self.log("{} is deprecated but defined in method {}; it will be ignored by Core Lightning".format(attr_name, method_name), level="warn")
self.add_method(method_name, f, background=True, deprecated=deprecated)
return f
return decorator

def method(self, method_name: str, category: Optional[str] = None,
desc: Optional[str] = None,
long_desc: Optional[str] = None,
def method(self, method_name: str,
deprecated: Union[bool, List[str]] = None) -> JsonDecoratorType:
"""Decorator to add a plugin method to the dispatch table.

Internally uses add_method.
"""
def decorator(f: Callable[..., JSONType]) -> Callable[..., JSONType]:
for attr, attr_name in [(category, "Category"), (desc, "Description"), (long_desc, "Long description")]:
if attr is not None:
self.log("{} is deprecated but defined in method {}; it will be ignored by Core Lightning".format(attr_name, method_name), level="warn")
self.add_method(method_name, f, background=False, deprecated=deprecated)
return f
return decorator
Expand Down
Loading