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

Literals with quotations produce odd outputs #287

Open
irm-codebase opened this issue Jun 25, 2024 · 0 comments
Open

Literals with quotations produce odd outputs #287

irm-codebase opened this issue Jun 25, 2024 · 0 comments
Labels

Comments

@irm-codebase
Copy link

Describe the bug
Adding `Literal["something", "otherthing"] will lead to a very weird output by autoDocstring:

Versions (please complete the following information):

  • autoDocstring Version: 0.6.1
  • Operating System: Linux Fedora 39
  • Vscode Version: 1.90

Original Code (with line to generate on):

    def _add_component(
        self,
        name: str,
        component_dict: Optional[Tp],
        component_setter: Callable,
        component_type: Literal[
            "variables", "global_expressions", "constraints", "objectives"
        ],
        break_early: bool = True,
    ) -> Optional[parsing.ParsedBackendComponent]:
        """_summary_

        Args:
            name (str): _description_
            component_dict (Optional[Tp]): _description_
            component_setter (Callable): _description_
            component_type (Literal[ "variables", "global_expressions", "constraints", "objectives" ]): _description_
            break_early (bool, optional): _description_. Defaults to True.

        Raises:
            BackendError: _description_

        Returns:
            Optional[parsing.ParsedBackendComponent]: _description_
        """

Expected Result:

component_type (Literal[ "variables", "global_expressions", "constraints", "objectives"]): _description_

Actual Result:

component_type (Literal[ "variables", "global_expressions", "constraints", "objectives" ]): _description_

Debug log:
Set autoDocstring.logLevel to "Debug", recreate the bug, and then copy the debug logs from the autoDocstring output channel.

[INFO 20:41:27.969] autoDocstring was activated
[INFO 21:00:00.535] Generating Docstring at line: 252
[INFO 21:00:00.538] Docstring generated:
        """${1:_summary_}

        Args:
            name (${2:str}): ${3:_description_}
            component_dict (${4:Optional[Tp]}): ${5:_description_}
            component_setter (${6:Callable}): ${7:_description_}
            component_type (${8:Literal[ "variables", "global_expressions", "constraints", "objectives" ]}): ${9:_description_}
            break_early (${10:bool}, optional): ${11:_description_}. Defaults to True.

        Raises:
            BackendError: ${12:_description_}

        Returns:
            ${13:Optional[parsing.ParsedBackendComponent]}: ${14:_description_}
        """
[INFO 21:00:00.538] Inserting at position: 252 0
[INFO 21:00:00.546] Successfully inserted docstring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant