Skip to content

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

Open
@amittendulkar

Description

@amittendulkar

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    WORK IN PROGRESSPR not ready to merge. Or Issue being worked on.enhancementRequest for improvement: either for an existing feature or a new one

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions