RIDE icon indicating copy to clipboard operation
RIDE copied to clipboard

RIDE v2.0b1: RIDE shows the decorator arguments in the keyword help even after using functools.wraps

Open amittendulkar opened this issue 4 years ago • 2 comments

RIDE v2.0b1 running on Python 3.8.5.

Suppose I have a python library like the below. You can notice that I am using a decorator to print the function arguments. To preserve the original keyword function signature, I have used the functools.wraps decorator for the decorator itself.

# Config.py
from functools import wraps
from robot.api.logger import info, debug

def log_func(func):
  @wraps(func)
  def inner1(*args, **kwargs):
    info(f'Inside {func.__name__}')
    debug(f'Arguments: {args}, {kwargs}')
    r_val = func(*args, **kwargs)
    info(f'Exiting {func.__name__}')
    return r_val

  return inner1


class Config:
  @staticmethod
  @log_func
  def activate_config_file(filename: str):
    # Do something with the argument

  # other keywords

After the functools.wraps decorator the LibDoc is able to generate the help of activate_config_file properly. However, RIDE still shows the decorator arguments in its help as follows.

image

amittendulkar avatar Aug 12 '21 10:08 amittendulkar

This issue is derived from https://github.com/robotframework/robotframework/issues/4058

amittendulkar avatar Aug 12 '21 10:08 amittendulkar

@amittendulkar Thanks for the report. RIDE is still using internally the version 3.1.2 of Robot Framework, so new features since 3.2.2 may be missing or incompatible. The effort to adjust to RF 3.2.2 and 4.1.1, has shown to be too big (for me the lonelly maintainer of this project), so I decided to make version 2.0 as a patched version with important features.

It may take a while to have this incorporated, but it may be faster if you create a Pull Request. Thanks.

HelioGuilherme66 avatar Aug 12 '21 20:08 HelioGuilherme66