intellij-writer icon indicating copy to clipboard operation
intellij-writer copied to clipboard

Comments placed in the wrong location.

Open raphant opened this issue 3 years ago • 2 comments

Environment

AI Doc Writer Version: 1.0.10 PyCharm Version: 2021.3.2 OS: Manjaro 5.16.7

Issue

When generating docs for a property function formatted like the code below, the docstring is added to the wrong location.

Before generation

    @property
    def indicators(
        self,
    ) -> dict[str, Union[ind.Indicator, ind.OverlayIndicator, ind.IndexIndicator]]:
        return self._active_indicators

After generation

    @property
    def indicators(
	    """
	    Returns a dictionary of all the active indicators
	    :return: A dictionary of indicator objects.
	    """
        self,
    ) -> dict[str, Union[ind.Indicator, ind.OverlayIndicator, ind.IndexIndicator]]:
        return self._active_indicators

Expected

    @property
    def indicators(
        self,
    ) -> dict[str, Union[ind.Indicator, ind.OverlayIndicator, ind.IndexIndicator]]:
        """
        Returns a dictionary of all the active indicators
        :return: A dictionary of indicator objects.
        """
        return self._active_indicators

raphant avatar Feb 19 '22 17:02 raphant

This also happens in regular functions with similar formatting.

Before

def download_missing_historical_data(
    strategy: str,
    config: Config,
    parameters: Union[BacktestParameters, HyperoptParameters],
):
    timerange: str = parameters.timerange
    start_date, end_date = timerange.split('-')
    start_date = dateutil.parser.parse(start_date).replace(tzinfo=utc)
	...

After

def download_missing_historical_data(
    """
    It checks if the data is already downloaded for the given
    pairs and intervals. If not, it downloads the data
    
    :param strategy: The name of the strategy to use
    :type strategy: str
    :param config: Config
    :type config: Config
    :param parameters: Union[BacktestParameters, HyperoptParameters]
    :type parameters: Union[BacktestParameters, HyperoptParameters]
    """
    strategy: str,
    config: Config,
    parameters: Union[BacktestParameters, HyperoptParameters],
):
	timerange: str = parameters.timerange
    start_date, end_date = timerange.split('-')
    start_date = dateutil.parser.parse(start_date).replace(tzinfo=utc)
	...

raphant avatar Feb 19 '22 18:02 raphant

+1

SteinRobert avatar Apr 13 '22 08:04 SteinRobert