79640214

Date: 2025-05-27 09:52:00
Score: 2.5
Natty:
Report link

I found that I can use decorators to archive partially what I'm looking for.

Using a solution similar to this answer (https://stackoverflow.com/a/2575999/), I can show in Sphinx docs the values instead of the variable names.

def fixdocstring(func):
  
    constants_value = [..., constants.WIDTH, ...]

    for i in range(len(constants_name)):
        func.__doc__ = func.__doc__.replace("constants."+constants_name[i],str(constants_value[i]))

And use it in the functions that I want to change.

@fixdocstring
def train_network(...)
"""
...

Args:
    width (int):
        Width of the network from which the images will be processed. Must be a multiple of 32. The default is constants.WIDTH.
"""

In Sphinx docs: Result

Unfortunately, this is not recognized by Intellisense in VSCode.

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: vlopezb0