vitsalis / PyCG

Static Python call graph generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyCG on file text

lambdaofgod opened this issue · comments

Is there a simple way to call PyCG on a file contents instead passing files?

If you mean PyCG reading from the source code from the standard input, no PyCG does not currently support that.

I mean more like just passing file text as string instead of file.

Is there a fundamental reason why this would be hard?

It would require some refactoring since PyCG currently expects source files to be given as input. Can you give a use case where this functionality might be useful?

I have a dataframe with contents of several hundred thousands of files that I scraped, and I don't want to create a file for each one of them.

Sorry for the late reply, somehow missed the notification for that one.

The use case you are outlining makes sense. Unfortunately at this time, I don't have the resources to implement that, but I would be happy to assist you with an implementation plan.

I would start with the base processor (base.py:ProcessingBase). This class is in charge of reading the files from the input. This functionality needs to be refactored so that one can pass a string of file contents as an argument.