Example #1
0
    def run(self, args):
        """checking arguments and run project"""
        if not args:
            print(self.help())
            return 1
        # insert current working directory to the python path to recognize
        # dependencies to local modules even if cwd is not in the PYTHONPATH
        sys.path.insert(0, os.getcwd())
        try:
            project = project_from_files(
                args,
                project_name=self.config.project,
                black_list=self.config.black_list,
            )
            linker = Linker(project, tag=True)
            handler = DiadefsHandler(self.config)
            diadefs = handler.get_diadefs(project, linker)
        finally:
            sys.path.pop(0)

        if self.config.output_format == "vcg":
            writer.VCGWriter(self.config).write(diadefs)
        else:
            writer.DotWriter(self.config).write(diadefs)
        return 0
def get_project(module, name="No Name"):
    """return an astroid project representation"""

    def _astroid_wrapper(func, modname):
        return func(modname)

    return project_from_files([module], _astroid_wrapper, project_name=name)
def get_project(module, name="No Name"):
    """return an astroid project representation"""

    def _astroid_wrapper(func, modname):
        return func(modname)

    return project_from_files([module], _astroid_wrapper, project_name=name)
Example #4
0
    def run(self, args):
        """checking arguments and run project"""
        if not args:
            print(self.help())
            return 1
        # insert current working directory to the python path to recognize
        # dependencies to local modules even if cwd is not in the PYTHONPATH
        sys.path.insert(0, os.getcwd())
        try:
            project = project_from_files(
                args,
                project_name=self.config.project,
                black_list=self.config.black_list,
            )
            linker = Linker(project, tag=True)
            handler = DiadefsHandler(self.config)
            diadefs = handler.get_diadefs(project, linker)
        finally:
            sys.path.pop(0)

        if self.config.output_format == "vcg":
            writer.VCGWriter(self.config).write(diadefs)
        else:
            writer.DotWriter(self.config).write(diadefs)
        return 0
Example #5
0
    def _get_project(module: str, name: Optional[str] = "No Name") -> Project:
        """return an astroid project representation"""
        def _astroid_wrapper(func: Callable, modname: str) -> Module:
            return func(modname)

        return project_from_files([module],
                                  _astroid_wrapper,
                                  project_name=name)
Example #6
0
    def _get_project(module: str, name: str | None = "No Name") -> Project:
        """Return an astroid project representation."""
        def _astroid_wrapper(func: Callable, modname: str) -> Module:
            return func(modname)

        with fix_import_path([module]):
            project = project_from_files([module],
                                         _astroid_wrapper,
                                         project_name=name)
        return project
Example #7
0
 def run(self, args):
     """checking arguments and run project"""
     if not args:
         print(self.help())
         return 1
     with fix_import_path(args):
         project = project_from_files(
             args,
             project_name=self.config.project,
             black_list=self.config.ignore_list,
         )
     linker = Linker(project, tag=True)
     handler = DiadefsHandler(self.config)
     diadefs = handler.get_diadefs(project, linker)
     writer.DiagramWriter(self.config).write(diadefs)
     return 0