Skip to content

Pyment not respecting type annotations #126

Description

@thedannymarsh

Hi, thanks for creating such a cool tool! I am having an issue with my docstrings where the types are not getting recognized. For example, when I run pyment on one of my files, it changes the docstring as shown below in the git diff:

     def potentials_exist(self, sim_dir: str) -> bool:
         """Return bool deciding if potentials have already been written for this sim.

         :param sim_dir: directory of this simulation
-        :return: boolean!
+        :param sim_dir: str) -> boo:
+        :returns: boolean indicating whether the potentials exist
+
         """
         return all(os.path.exists(os.path.join(sim_dir, 'potentials', str(p))) for p, _ in self.master_product_indices)

What I would expect is the following:


     def potentials_exist(self, sim_dir: str) -> bool:
         """Return bool deciding if potentials have already been written for this sim.

         :param sim_dir: directory of this simulation
+        :rtype sim_dir: str
         :return: boolean indicating whether the potentials exist
+        :rtype: bool
         """
         return all(os.path.exists(os.path.join(sim_dir, 'potentials', str(p))) for p, _ in self.master_product_indices)

I am using pyment v0.3.4
Is there something I am doing wrong? My command is:
pyment -i reST -o reST -w src/core/simulation.py
I have also tried it without specifying -i and -o and get the same result.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions