Giter Club home page Giter Club logo

code2flow's People

Contributors

kbittick3 avatar klaernie avatar pandaft avatar rachfop avatar scott-utilityapi avatar scottrogowski avatar techieshark avatar timgates42 avatar toelke avatar yonashub avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

code2flow's Issues

Performance

I am running this on a ~1.2mb 38kloc browserified source file, and it's been running for > 10 mins at 100% cpu on a core i7. no disk output, and no output from strace so it appears internally cpu bound. a note of advisement as to the applicability to project size would probably be helpful.

Update: Traceback when I Ctrl-C it is:

Traceback (most recent call last):
  File "/home/user/.pyenv/versions/2.7.9/bin/code2flow", line 4, in <module>
    __import__('pkg_resources').run_script('code2flow==0.2', 'code2flow')
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 723, in run_script
  File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1643, in run_script
  File "/home/user/.pyenv/versions/2.7.9/lib/python2.7/site-packages/code2flow-0.2-py2.7.egg/EGG-INFO/scripts/code2flow", line 151, in <module>

  File "build/bdist.linux-x86_64/egg/code2flowlib/engine.py", line 810, in map
  File "build/bdist.linux-x86_64/egg/code2flowlib/engine.py", line 369, in __init__
  File "build/bdist.linux-x86_64/egg/code2flowlib/engine.py", line 721, in _removeCommentsAndStrings

Update 2: the original source file had (believe it or not) >2mb of sourceMap (a single massive line) appended to it. Once I removed it, code2flow did complete after several minutes, so perhaps there is a pathological case in extremely long comment.

[Feature Request] Call code2flow from code

Is it possible to run code2flow from code? In a library of mine, I'm adding a callgraph sphinx directive for embedding graphs in docs. My issue is I have to use something like subprocess to run to generate the graph, and that's a horrible solution.

Cannot install code2flow

Hi,

I am a real rookie in this, but I want to install code2flow on my macbook with intel chip. but I got some problems.

  • First I install code2flow with: pip3 install code2flow. it is installed but when I want to use it for example: code2flow myjavascriptfile.js it says: command not found: code2flow.
  • Then I want to install graphviz with brew and I get this error message: Warning: No available formula with the name "graphviz".
    ==> Searching for similarly named formulae...
    Error: No similarly named formulae found.
    It was migrated from homebrew/cask to homebrew/core.

Can someone help me? Thanks a lot!

Hi

can it get this to work with brew please?
ports is too old

Request: New Shape

As per Russian standard for block-schemes, there is a shape for functions/methods defined elsewhere.
It looks like this in plain style:
изображение

I'll try to take a look at the code on my free time, but will promise nothing

C:\Python27\python.exe: can't open file '/cygdrive/c/Python27/Scripts/code2flow': [Errno 2] No such file or directory

Hi after installing code2flow , the process has finish successfully

$ python setup.py install
running install
running bdist_egg
running egg_info
creating code2flow.egg-info
writing code2flow.egg-info\PKG-INFO
writing top-level names to code2flow.egg-info\top_level.txt
writing dependency_links to code2flow.egg-info\dependency_links.txt
writing manifest file 'code2flow.egg-info\SOURCES.txt'
reading manifest file 'code2flow.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.txt' under directory 'docs'
writing manifest file 'code2flow.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\code2flowlib
copying code2flowlib\dotgenerator.py -> build\lib\code2flowlib
copying code2flowlib\engine.py -> build\lib\code2flowlib
copying code2flowlib\mutablestring.py -> build\lib\code2flowlib
copying code2flowlib\nesting.py -> build\lib\code2flowlib
copying code2flowlib\__init__.py -> build\lib\code2flowlib
creating build\lib\testscripts
copying testscripts\pysimple.py -> build\lib\testscripts
copying testscripts\pysimple2.py -> build\lib\testscripts
copying testscripts\pysimple3.py -> build\lib\testscripts
copying testscripts\urllib2.py -> build\lib\testscripts
copying testscripts\__init__.py -> build\lib\testscripts
creating build\lib\code2flowlib\languages
copying code2flowlib\languages\javascript.py -> build\lib\code2flowlib\languages
copying code2flowlib\languages\python.py -> build\lib\code2flowlib\languages
copying code2flowlib\languages\__init__.py -> build\lib\code2flowlib\languages
creating build\bdist.win32
creating build\bdist.win32\egg
creating build\bdist.win32\egg\code2flowlib
copying build\lib\code2flowlib\dotgenerator.py -> build\bdist.win32\egg\code2flowlib
copying build\lib\code2flowlib\engine.py -> build\bdist.win32\egg\code2flowlib
creating build\bdist.win32\egg\code2flowlib\languages
copying build\lib\code2flowlib\languages\javascript.py -> build\bdist.win32\egg\code2flowlib\languages
copying build\lib\code2flowlib\languages\python.py -> build\bdist.win32\egg\code2flowlib\languages
copying build\lib\code2flowlib\languages\__init__.py -> build\bdist.win32\egg\code2flowlib\languages
copying build\lib\code2flowlib\mutablestring.py -> build\bdist.win32\egg\code2flowlib
copying build\lib\code2flowlib\nesting.py -> build\bdist.win32\egg\code2flowlib
copying build\lib\code2flowlib\__init__.py -> build\bdist.win32\egg\code2flowlib
creating build\bdist.win32\egg\testscripts
copying build\lib\testscripts\pysimple.py -> build\bdist.win32\egg\testscripts
copying build\lib\testscripts\pysimple2.py -> build\bdist.win32\egg\testscripts
copying build\lib\testscripts\pysimple3.py -> build\bdist.win32\egg\testscripts
copying build\lib\testscripts\urllib2.py -> build\bdist.win32\egg\testscripts
copying build\lib\testscripts\__init__.py -> build\bdist.win32\egg\testscripts
byte-compiling build\bdist.win32\egg\code2flowlib\dotgenerator.py to dotgenerator.pyc
byte-compiling build\bdist.win32\egg\code2flowlib\engine.py to engine.pyc
byte-compiling build\bdist.win32\egg\code2flowlib\languages\javascript.py to javascript.pyc
byte-compiling build\bdist.win32\egg\code2flowlib\languages\python.py to python.pyc
byte-compiling build\bdist.win32\egg\code2flowlib\languages\__init__.py to __init__.pyc
byte-compiling build\bdist.win32\egg\code2flowlib\mutablestring.py to mutablestring.pyc
byte-compiling build\bdist.win32\egg\code2flowlib\nesting.py to nesting.pyc
byte-compiling build\bdist.win32\egg\code2flowlib\__init__.py to __init__.pyc
byte-compiling build\bdist.win32\egg\testscripts\pysimple.py to pysimple.pyc
byte-compiling build\bdist.win32\egg\testscripts\pysimple2.py to pysimple2.pyc
byte-compiling build\bdist.win32\egg\testscripts\pysimple3.py to pysimple3.pyc
byte-compiling build\bdist.win32\egg\testscripts\urllib2.py to urllib2.pyc
byte-compiling build\bdist.win32\egg\testscripts\__init__.py to __init__.pyc
creating build\bdist.win32\egg\EGG-INFO
installing scripts to build\bdist.win32\egg\EGG-INFO\scripts
running install_scripts
running build_scripts
creating build\scripts-2.7
copying and adjusting code2flow -> build\scripts-2.7
creating build\bdist.win32\egg\EGG-INFO\scripts
copying build\scripts-2.7\code2flow -> build\bdist.win32\egg\EGG-INFO\scripts
copying code2flow.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying code2flow.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying code2flow.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
copying code2flow.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\code2flow-0.2-py2.7.egg' and adding 'build\bdist.win32\egg' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing code2flow-0.2-py2.7.egg
Copying code2flow-0.2-py2.7.egg to c:\python27\lib\site-packages
Adding code2flow 0.2 to easy-install.pth file
Installing code2flow script to C:\Python27\Scripts
Installed c:\python27\lib\site-packages\code2flow-0.2-py2.7.egg
Processing dependencies for code2flow==0.2
Finished processing dependencies for code2flow==0.2

When trying a simple run i get this error

$ code2flow
C:\Python27\python.exe: can't open file '/cygdrive/c/Python27/Scripts/code2flow': [Errno 2] No such file or directory

The problem is that the script folder contain code2flow ... but i get this error also when i have installed pyCallGraph

Mt python version is

$ python -V
Python 2.7.7
  • I'm on windows 7
    thanks

index out of range error

I found this lib in a blog and try to use with my project. I have lot of javascript files. When I use this lib, it process files (writes out to console) but always failed:

Traceback (most recent call last):
  File "/home/username/.local/bin/code2flow", line 8, in <module>
    sys.exit(main())
  File "/home/username/.local/lib/python3.8/site-packages/code2flow/engine.py", line 625, in main
    code2flow(
  File "/home/username/.local/lib/python3.8/site-packages/code2flow/engine.py", line 515, in code2flow
    output_ext = output_file.rsplit('.', 1)[1] or ''
IndexError: list index out of range

My command is here: code2flow --language js --output png $(pwd)

Can you help me whit this issue?

fit() and transform() methods from separate classes

When two classes have the same function names and only one of those classes is provided in the list of files, it seems to map inaccurately to the other class. For example, MinMaxScaler() from sklearn which has fit() and transform() methods, and then a user-defined function for a different class, also with fit() and transform() methods. I'm guessing that it might resolve it OK if I were to supply the file for MinMaxScaler(), but this throws an error #29.

Is this behavior for classes with the same function names a known limitation?

Having problem to get bigger graphs

Using the following command

code2flow main.py --target-function main --upstream-depth=10 --downstream-depth=10

my result is:
out

and my main.py code is

from video_generator import VideoGenerator
from typing import NamedTuple

def main(url: str):
    # create_video(url)
    vg = VideoGenerator()
    vg.create_video(url)

Log code2flow

Code2Flow: Found 1 files from sources argument.
Code2Flow: Implicitly detected language as 'py'.
Code2Flow: Processing 1 source file(s).
Code2Flow:   main.py
Code2Flow: Found groups ['File: main', 'Class: EditVideoConfiguration'].
Code2Flow: Found nodes ['(global)', 'gap_amount', 'main', 'overlay_audios'].
Code2Flow: Found calls ['EditVideoConfiguration()', 'VideoGenerator()', 'final_audio_parts.append()', 'gap_amount()', 'lower_volume_original_audio.overlay()', 'main()', 'sum()', 'vg.create_video()', 'zip()'].
Code2Flow: Found variables ['NamedTuple->UNKNOWN_MODULE', 'VideoGenerator->UNKNOWN_MODULE', 'config->EditVideoConfiguration', 'overlay_audio-><Call owner_token=lower_volume_original_audio token=overlay>', 'vg-><Call owner_token=None token=VideoGenerator>'].
Code2Flow: Filtering into subset...
Code2Flow: Generating output file...
Code2Flow: Wrote output file 'out.gv' with 2 nodes and 14 edges.
Code2Flow: For better machine readability, you can also try outputting in a json format.
Code2Flow: Code2flow finished processing in 0.00 seconds.
Code2Flow: Running graphviz to make the image...
Code2Flow: Graphviz finished in 0.04 seconds.
Code2Flow: Completed your flowchart! To see it, open 'out.png'.

Running code2flow on chipscopy library causes crash.

Running code2flow on chipscopy library causes crash. The library is stable and fully functional.
Library location:
https://github.com/Xilinx/chipscopy/tree/master/chipscopy
Command: code2flow -v C:\chipscopy
Python rev: 3.9.5
Operating system: Windows 10

Traceback (most recent call last):
File "C:\Python39\Scripts\code2flow-script.py", line 33, in
sys.exit(load_entry_point('code2flow==2.3.0', 'console_scripts', 'code2flow')())
File "C:\Python39\lib\site-packages\code2flow\engine.py", line 630, in main
code2flow(
File "C:\Python39\lib\site-packages\code2flow\engine.py", line 536, in code2flow
file_groups, all_nodes, edges = map_it(sources, language, no_trimming,
File "C:\Python39\lib\site-packages\code2flow\engine.py", line 324, in map_it
file_group = make_file_group(file_ast_tree, source, extension)
File "C:\Python39\lib\site-packages\code2flow\engine.py", line 208, in make_file_group
file_group.add_node(language.make_root_node(body_trees, parent=file_group), is_root=True)
File "C:\Python39\lib\site-packages\code2flow\python.py", line 229, in make_root_node
variables = make_local_variables(lines, parent)
File "C:\Python39\lib\site-packages\code2flow\python.py", line 122, in make_local_variables
variables += process_import(element)
File "C:\Python39\lib\site-packages\code2flow\python.py", line 99, in process_import
rhs = djoin(element.module, rhs)
File "C:\Python39\lib\site-packages\code2flow\model.py", line 51, in djoin
return '.'.join(tup)
TypeError: sequence item 0: expected str instance, NoneType found

sequence diagram visualization

it will be nice if there is an sequence diagram visualization option.

this diagram represent one main function in DOT flowcharts and it will be more readable i guess.

image

Request: distinguish functions with the same name but in different files

Hello! I tried to use code2flow on some python projects, And found it cannot distinguish files with the same name but in different directories, or functions with the same name but in different files. Also it becomes a mess if the two cases happen in the same time.

I also looked into the source code. The first problem can be fixed by changing line 348 in engine.py to include the full path into group name. But the second one seems much more difficult. I guess what you get from an ast Call node is only the function name, not enough to tell which function it is if there are more than one function with the same name in the project. But maybe we can use import statement to do this. But to do this, we need to relate the module name in import statement with the corresponding file full path.

Maybe you can check this problem and see if there's another solution? I think this is not a rare case so a solution is needed.

Tracing through many files and modules

I don't know if I use this program wrong but when I try to generate a call graph for a (bigger) package, I call code2flow main.py. But then the graph ends in main.py even though it calls many other modules within the same package/directory. When adding many .py files that also call upon each other, code2flow simply creates separated graphs in one file for each file. Is this what the programs is supposed to do or am I doing doing it wrong?

Thoughts on making JS prototypes work

It'd be nice if prototypes worked correctly.
But there's the question of how they'd be represented on the graph.

Just to think out loud, this would possibly require code2flow to be able to differentiate between object methods (e.g. toString) and normal functions.
This would then allow the graph to represent which object method is being called (e.g. if a class overrode the Object.toString method, that could be represented.

One thing I'm curious about is your decision to 'home-grow' the regular expressions etc - have you deliberately decided not to use existing tools (say uglifyjs) to generate an AST and work from there?
On a related note, have you seen https://github.com/abort/javascript-call-graph?

Just pondering on the most appropriate tool for the job at the moment.

subprocess.CalledProcessError: Command '['dot', '-Tpng', 'out.gv']' returned non-zero exit status 3221225477

(base) PS C:\Users\sterg\anaconda3\envs\elm2d-crabnet\Lib\site-packages\sklearn\preprocessing> code2flow _data.py
Code2Flow: Found 1 files from sources argument.
Code2Flow: Implicitly detected language as 'py'.
Code2Flow: Processing 1 source file(s).
Code2Flow:   _data.py
Code2Flow: Found groups ['File: _data', 'Class: MinMaxScaler', 'Class: StandardScaler', 'Class: MaxAbsScaler', 'Class: RobustScaler', 'Class: PolynomialFeatures', 'Class: Normalizer', 'Class: Binarizer', 'Class: KernelCenterer', 'Class: QuantileTransformer', 'Class: PowerTransformer'].
Code2Flow: Found nodes ['(global)', 'Binarizer.__init__', 'Binarizer._more_tags', 'Binarizer.fit', 'Binarizer.transform', 'KernelCenterer.__init__', 'KernelCenterer._more_tags', 'KernelCenterer._pairwise', 'KernelCenterer.fit', 'KernelCenterer.transform', 'MaxAbsScaler.__init__', 'MaxAbsScaler._more_tags', 'MaxAbsScaler._reset', 'MaxAbsScaler.fit', 'MaxAbsScaler.inverse_transform', 'MaxAbsScaler.partial_fit', 'MaxAbsScaler.transform', 'MinMaxScaler.__init__', 'MinMaxScaler._more_tags', 'MinMaxScaler._reset', 'MinMaxScaler.fit', 'MinMaxScaler.inverse_transform', 'MinMaxScaler.partial_fit', 'MinMaxScaler.transform', 'Normalizer.__init__', 'Normalizer._more_tags', 'Normalizer.fit', 'Normalizer.transform', 'PolynomialFeatures.__init__', 'PolynomialFeatures._combinations', 'PolynomialFeatures.fit', 'PolynomialFeatures.get_feature_names', 'PolynomialFeatures.powers_', 'PolynomialFeatures.transform', 'PowerTransformer.__init__', 'PowerTransformer._box_cox_inverse_tranform', 'PowerTransformer._box_cox_optimize', 'PowerTransformer._check_input', 'PowerTransformer._fit', 'PowerTransformer._more_tags', 'PowerTransformer._yeo_johnson_inverse_transform', 'PowerTransformer._yeo_johnson_optimize', 'PowerTransformer._yeo_johnson_transform', 'PowerTransformer.fit', 'PowerTransformer.fit_transform', 'PowerTransformer.inverse_transform', 'PowerTransformer.transform', 'QuantileTransformer.__init__', 'QuantileTransformer._check_inputs', 'QuantileTransformer._dense_fit', 'QuantileTransformer._more_tags', 'QuantileTransformer._sparse_fit', 'QuantileTransformer._transform', 'QuantileTransformer._transform_col', 'QuantileTransformer.fit', 'QuantileTransformer.inverse_transform', 'QuantileTransformer.transform', 'RobustScaler.__init__', 'RobustScaler._more_tags', 'RobustScaler.fit', 'RobustScaler.inverse_transform', 'RobustScaler.transform', 'StandardScaler.__init__', 'StandardScaler._more_tags', 'StandardScaler._reset', 'StandardScaler.fit', 'StandardScaler.inverse_transform', 'StandardScaler.partial_fit', 'StandardScaler.transform', '_handle_zeros_in_scale', 'add_dummy_feature', 'binarize', 'maxabs_scale', 'minmax_scale', 'normalize', 'power_transform', 'quantile_transform', 'robust_scale', 'scale'].
Code2Flow: Found calls ['MaxAbsScaler()', 'MinMaxScaler()', 'NotImplementedError()', 'PowerTransformer()', 'QuantileTransformer()', 'RobustScaler()', 'StandardScaler()', 'TypeError()', 'UNKNOWN_VAR.astype()', 'UNKNOWN_VAR.format()', 'UNKNOWN_VAR.join()', 'UNKNOWN_VAR.sum()', 'UNKNOWN_VAR.tocsc()', 'UNKNOWN_VAR.tocsr()', 'ValueError()', 'X.copy()', 'X.eliminate_zeros()', 'X.multiply()', 'X.ravel()', 'X.reshape()', 'X.tocoo()', 'X.tocsc()', 'X.tocsr()', '_check_sample_weight()', '_csr_polynomial_expansion()', '_handle_zeros_in_scale()', '_incremental_mean_and_var()', '_incremental_weighted_mean_and_var()', 'abs()', 'add_dummy_feature()', 'binarize()', 'chain.from_iterable()', 'check_array()', 'check_is_fitted()', 'check_random_state()', 'col.take()', 'columns.append()', 'comb()', 'enumerate()', 'feature_names.append()', 'hasattr()', 'incr_mean_variance_axis()', 'index.append()', 'inplace_column_scale()', 'inplace_csr_row_normalize_l1()', 'inplace_csr_row_normalize_l2()', 'int()', 'inv_fun()', 'isinstance()', 'klass()', 'len()', 'list()', 'max()', 'mean_variance_axis()', 'min()', 'min_max_axis()', 'n.fit_transform()', 'new_index.append()', 'normalize()', 'norms.repeat()', 'np.abs()', 'np.accumulate()', 'np.allclose()', 'np.any()', 'np.arange()', 'np.array()', 'np.asarray()', 'np.bincount()', 'np.catch_warnings()', 'np.clip()', 'np.concatenate()', 'np.diff()', 'np.empty()', 'np.errstate()', 'np.exp()', 'np.filterwarnings()', 'np.full()', 'np.hstack()', 'np.interp()', 'np.isnan()', 'np.isscalar()', 'np.linspace()', 'np.log()', 'np.log1p()', 'np.logical_not()', 'np.max()', 'np.maximum()', 'np.minimum()', 'np.multiply()', 'np.nanmax()', 'np.nanmean()', 'np.nanmedian()', 'np.nanmin()', 'np.nanpercentile()', 'np.nanstd()', 'np.ones()', 'np.power()', 'np.ptp()', 'np.repeat()', 'np.rollaxis()', 'np.sign()', 'np.size()', 'np.spacing()', 'np.sqrt()', 'np.sum()', 'np.transpose()', 'np.vstack()', 'np.where()', 'np.zeros()', 'np.zeros_like()', 'optim_function()', 'optimize.brent()', 'pt.fit_transform()', 'quantiles.append()', 'random_state.choice()', 'range()', 'row_norms()', 's.fit_transform()', 'scale.copy()', 'self._check_input()', 'self._check_inputs()', 'self._combinations()', 'self._dense_fit()', 'self._fit()', 'self._reset()', 'self._sparse_fit()', 'self._transform()', 'self._transform_col()', 'self._validate_data()', 'self._yeo_johnson_transform()', 'self.append()', 'self.astype()', 'self.fit()', 'self.fit_transform()', 'self.inverse_transform()', 'self.partial_fit()', 'self.sum()', 'self.transform()', 'slice()', 'sparse.coo_matrix()', 'sparse.csc_matrix()', 'sparse.hstack()', 'sparse.issparse()', 'sparse.isspmatrix()', 'sparse.isspmatrix_coo()', 'sparse.isspmatrix_csc()', 'sparse.isspmatrix_csr()', 'sparse_constructor()', 'stats.boxcox()', 'stats.cdf()', 'stats.ppf()', 'str()', 'sum()', 'to_stack.append()', 'transform_function()', 'warnings.warn()', 'x_trans.var()', 'zip()'].
Code2Flow: Found variables ['BaseEstimator->UNKNOWN_MODULE', 'FLOAT_DTYPES->UNKNOWN_MODULE', 'K-><Call owner_token=self token=_validate_data>', 'OneHotEncoder->UNKNOWN_MODULE', 'TransformerMixin->UNKNOWN_MODULE', 'X-><Call owner_token=None token=check_array>', 'X-><Call owner_token=X token=copy>', 'X-><Call owner_token=X token=ravel>', 'X-><Call owner_token=X token=reshape>', 'X-><Call owner_token=X token=tocsr>', 'X-><Call owner_token=np token=asarray>', 'X-><Call owner_token=s token=fit_transform>', 'X-><Call owner_token=self token=_check_input>', 'X-><Call owner_token=self token=_check_inputs>', 'X-><Call owner_token=self token=_validate_data>', 'X-><Call owner_token=self token=fit_transform>', 'X-><Call owner_token=self token=inverse_transform>', 'X-><Call owner_token=self token=transform>', 'XP-><Call owner_token=UNKNOWN_VAR token=tocsc>', 'XP-><Call owner_token=np token=empty>', 'XP-><Call owner_token=sparse token=hstack>', 'X_col-><Call owner_token=np token=clip>', 'X_col-><Call owner_token=stats token=cdf>', 'X_col-><Call owner_token=stats token=ppf>', 'Xp_next-><Call owner_token=None token=_csr_polynomial_expansion>', 'Xr-><Call owner_token=np token=rollaxis>', '_check_sample_weight->UNKNOWN_MODULE', '_csr_polynomial_expansion->UNKNOWN_MODULE', '_deprecate_positional_args->UNKNOWN_MODULE', '_incremental_mean_and_var->UNKNOWN_MODULE', '_incremental_weighted_mean_and_var->UNKNOWN_MODULE', 'bias-><Call owner_token=sparse token=csc_matrix>', 'boxcox->UNKNOWN_MODULE', 'chain->UNKNOWN_MODULE', 'check_array->UNKNOWN_MODULE', 'check_is_fitted->UNKNOWN_MODULE', 'check_random_state->UNKNOWN_MODULE', 'clip_max-><Call owner_token=stats token=ppf>', 'clip_min-><Call owner_token=stats token=ppf>', 'col-><Call owner_token=col token=take>', 'col-><Call owner_token=np token=concatenate>', 'column_data-><Call owner_token=np token=zeros>', 'column_slice-><Call owner_token=None token=slice>', 'combinations-><Call owner_token=self token=_combinations>', 'combinations->UNKNOWN_MODULE', 'combinations_w_r->UNKNOWN_MODULE', 'data-><Call owner_token=np token=concatenate>', 'data_max-><Call owner_token=np token=maximum>', 'data_max-><Call owner_token=np token=nanmax>', 'data_min-><Call owner_token=np token=minimum>', 'data_min-><Call owner_token=np token=nanmin>', 'deprecated->UNKNOWN_MODULE', 'incr_mean_variance_axis->UNKNOWN_MODULE', 'index-><Call owner_token=None token=list>', 'indices-><Call owner_token=np token=concatenate>', 'indptr-><Call owner_token=np token=concatenate>', 'inplace_column_scale->UNKNOWN_MODULE', 'inplace_csr_row_normalize_l1->UNKNOWN_MODULE', 'inplace_csr_row_normalize_l2->UNKNOWN_MODULE', 'max_abs-><Call owner_token=np token=maximum>', 'max_abs-><Call owner_token=np token=nanmax>', 'mean_-><Call owner_token=np token=nanmean>', 'mean_1-><Call owner_token=np token=nanmean>', 'mean_2-><Call owner_token=np token=nanmean>', 'mean_variance_axis->UNKNOWN_MODULE', 'min_max_axis->UNKNOWN_MODULE', 'n->QuantileTransformer', 'name-><Call owner_token=UNKNOWN_VAR token=join>', 'norms-><Call owner_token=None token=_handle_zeros_in_scale>', 'norms-><Call owner_token=None token=row_norms>', 'norms-><Call owner_token=UNKNOWN_VAR token=sum>', 'norms-><Call owner_token=np token=max>', 'norms-><Call owner_token=np token=maximum>', 'norms_elementwise-><Call owner_token=norms token=repeat>', 'not_cond-><Call owner_token=np token=logical_not>', 'np->UNKNOWN_MODULE', 'optimize->UNKNOWN_MODULE', 'out-><Call owner_token=np token=zeros_like>', 'out_col-><Call owner_token=X token=multiply>', 'pt->PowerTransformer', 'quantiles-><Call owner_token=np token=transpose>', 'rng-><Call owner_token=None token=check_random_state>', 'row-><Call owner_token=np token=concatenate>', 'row_norms->UNKNOWN_MODULE', 's->MaxAbsScaler', 's->MinMaxScaler', 's->RobustScaler', 'sample_weight-><Call owner_token=None token=_check_sample_weight>', 'scale-><Call owner_token=scale token=copy>', 'scale_-><Call owner_token=None token=_handle_zeros_in_scale>', 'scale_-><Call owner_token=np token=nanstd>', 'self->Binarizer', 'self->KernelCenterer', 'self->MaxAbsScaler', 'self->MinMaxScaler', 'self->Normalizer', 'self->PolynomialFeatures', 'self->PowerTransformer', 'self->QuantileTransformer', 'self->RobustScaler', 'self->StandardScaler', 'sparse->UNKNOWN_MODULE', 'start-><Call owner_token=None token=int>', 'stats->UNKNOWN_MODULE', 'subsample_idx-><Call owner_token=random_state token=choice>', 'var-><Call owner_token=None token=_handle_zeros_in_scale>', 'warnings->UNKNOWN_MODULE', 'weights-><Call owner_token=None token=_check_sample_weight>', 'x_inv-><Call owner_token=np token=exp>', 'x_inv-><Call owner_token=np token=zeros_like>', 'x_trans-><Call owner_token=self token=_yeo_johnson_transform>'].
Code2Flow: Generating output file...
Code2Flow: Wrote output file 'out.gv' with 48 nodes and 55 edges.
Code2Flow: For better machine readability, you can also try outputting in a json format.
Code2Flow: Code2flow finished processing in 0.04 seconds.
Code2Flow: Running graphviz to make the image...
Traceback (most recent call last):
  File "C:\Users\sterg\AppData\Local\Programs\Python\Python39\Scripts\code2flow-script.py", line 33, in <module>
    sys.exit(load_entry_point('code2flow==2.2.0', 'console_scripts', 'code2flow')())
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\engine.py", line 625, in main
    code2flow(
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\engine.py", line 556, in code2flow
    _generate_final_img(output_file, extension, final_img_filename, len(edges))
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\engine.py", line 473, in _generate_final_img
    _generate_graphviz(output_file, extension, final_img_filename)
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\engine.py", line 461, in _generate_graphviz
    subprocess.run(command, stdout=f, check=True)
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['dot', '-Tpng', 'out.gv']' returned non-zero exit status 3221225477.

Based on pachterlab/kb_python#67, maybe this is also a Windows issue.

Probably more related: xflr6/graphviz#69

Here's the out.gv.zip (zipped because of GitHub file requirements)

Not very time-sensitive for me.

AssertionError raised

My OS: WSL2 Ubuntu.

After I installed this package on Ubuntu using python3 -m pip install code2flow, I try with a python file:

code2flow a.py

The AssertionError is raised:

  File "/home/henry/.local/lib/python3.8/site-packages/code2flow/engine.py", line 725, in code2flow
    raise AssertionError(
AssertionError: Can't generate a flowchart image because neither `dot` nor `dot.exe` was found. Either install graphviz (see the README) or, if you just want an intermediate text file, set your --output file to use a supported text extension: {'json', 'gv', 'dot'}

I tried installing the graphviz package using python3 -m pip install graphviz`, I received another error:

Building wheels for collected packages: pygraphviz
  Building wheel for pygraphviz (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [54 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.8
      creating build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/graphviz.py -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/scraper.py -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/agraph.py -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/__init__.py -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/testing.py -> build/lib.linux-x86_64-3.8/pygraphviz
      creating build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_graph.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_layout.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_drawing.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_string.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_repr_mimebundle.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_readwrite.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_scraper.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_unicode.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_node_attributes.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_clear.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_close.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/__init__.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_subgraph.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_edge_attributes.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_html.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      running egg_info
      writing pygraphviz.egg-info/PKG-INFO
      writing dependency_links to pygraphviz.egg-info/dependency_links.txt
      writing top-level names to pygraphviz.egg-info/top_level.txt
      reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.png' under directory 'doc'
      warning: no files found matching '*.txt' under directory 'doc'
      warning: no files found matching '*.css' under directory 'doc'
      warning: no previously-included files matching '*~' found anywhere in distribution
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '.svn' found anywhere in distribution
      no previously-included directories found matching 'doc/build'
      writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
      copying pygraphviz/graphviz.i -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/graphviz_wrap.c -> build/lib.linux-x86_64-3.8/pygraphviz
      running build_ext
      building 'pygraphviz._graphviz' extension
      creating build/temp.linux-x86_64-3.8
      creating build/temp.linux-x86_64-3.8/pygraphviz
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-3.8/pygraphviz/graphviz_wrap.o
      pygraphviz/graphviz_wrap.c:2711:10: fatal error: graphviz/cgraph.h: No such file or directory
       2711 | #include "graphviz/cgraph.h"
            |          ^~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pygraphviz
  Running setup.py clean for pygraphviz
Failed to build pygraphviz
Installing collected packages: pygraphviz
  Running setup.py install for pygraphviz ... error
  error: subprocess-exited-with-error

  × Running setup.py install for pygraphviz did not run successfully.
  │ exit code: 1
  ╰─> [54 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.8
      creating build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/graphviz.py -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/scraper.py -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/agraph.py -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/__init__.py -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/testing.py -> build/lib.linux-x86_64-3.8/pygraphviz
      creating build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_graph.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_layout.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_drawing.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_string.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_repr_mimebundle.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_readwrite.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_attribute_defaults.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_scraper.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_unicode.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_node_attributes.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_clear.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_close.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/__init__.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_subgraph.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_edge_attributes.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      copying pygraphviz/tests/test_html.py -> build/lib.linux-x86_64-3.8/pygraphviz/tests
      running egg_info
      writing pygraphviz.egg-info/PKG-INFO
      writing dependency_links to pygraphviz.egg-info/dependency_links.txt
      writing top-level names to pygraphviz.egg-info/top_level.txt
      reading manifest file 'pygraphviz.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.png' under directory 'doc'
      warning: no files found matching '*.txt' under directory 'doc'
      warning: no files found matching '*.css' under directory 'doc'
      warning: no previously-included files matching '*~' found anywhere in distribution
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '.svn' found anywhere in distribution
      no previously-included directories found matching 'doc/build'
      writing manifest file 'pygraphviz.egg-info/SOURCES.txt'
      copying pygraphviz/graphviz.i -> build/lib.linux-x86_64-3.8/pygraphviz
      copying pygraphviz/graphviz_wrap.c -> build/lib.linux-x86_64-3.8/pygraphviz
      running build_ext
      building 'pygraphviz._graphviz' extension
      creating build/temp.linux-x86_64-3.8
      creating build/temp.linux-x86_64-3.8/pygraphviz
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.8 -c pygraphviz/graphviz_wrap.c -o build/temp.linux-x86_64-3.8/pygraphviz/graphviz_wrap.o
      pygraphviz/graphviz_wrap.c:2711:10: fatal error: graphviz/cgraph.h: No such file or directory
       2711 | #include "graphviz/cgraph.h"
            |          ^~~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pygraphviz

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Acorn is installed but code2flow still doesn't work

Hell Scott~
I installed code2flow and it works well on python scripts.
However, when I want to generate plot of javascript scripts, it returns

Traceback (most recent call last):
  File "/opt/homebrew/bin/code2flow", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/lib/python3.10/site-packages/code2flow/engine.py", line 860, in main
    code2flow(
  File "/opt/homebrew/lib/python3.10/site-packages/code2flow/engine.py", line 734, in code2flow
    file_groups, all_nodes, edges = map_it(sources, language, no_trimming,
  File "/opt/homebrew/lib/python3.10/site-packages/code2flow/engine.py", line 462, in map_it
    language.assert_dependencies()
  File "/opt/homebrew/lib/python3.10/site-packages/code2flow/javascript.py", line 250, in assert_dependencies
    assert is_installed('acorn'), "Acorn is required to parse javascript files " \
AssertionError: Acorn is required to parse javascript files but was not found on the path. Install it from npm and try again.

I think I correctly installed Acorn in my home path. Shall I install Acorn in code2flow path?

[Feature request] Graphing jQuery calls

This might be a tough feature, yet it would be exceptionally useful if available. jQuery calls start with a dollar sign, or with (jQuery) with the parenthesis if used in non-conflict mode (iirc). That's where a lot of drawing is done.

I could give it a shot when I find some time.

[Feature Request] A select Namespace argument

Currently, in my project, I just care about how a couple of classes interact with each other. Using code2flow has been an amazing way to see just how they are connected and show it to others. The issue is I've had to write a script that gets every other namespace to ignore with the exceptions of the ones I want. The ability to say, I want a graph with just these classes would be amazing.

Python: Implicit decorator calls breaks `process_assign` with AssertionError

Sample code

from typing import Callable

def trace(fn: Callable) -> Callable:
    def wrapper(*args, **kwargs):
        print('traced call')
        return fn(*args, **kwargs)
    return wrapper

def do_something(msg):
    return msg + ' world'

message = 'hello'
new_message = trace(do_something)(message)

when fed into code2flow would produce an AssertionError

File "%/bin/code2flow", line 33, in <module>
sys.exit(load_entry_point('code2flow', 'console_scripts', 'code2flow')())
File "%/code2flow/engine.py", line 630, in main
code2flow(
File "%/code2flow/engine.py", line 536, in code2flow
file_groups, all_nodes, edges = map_it(sources, language, no_trimming,
File "%/code2flow/engine.py", line 324, in map_it
file_group = make_file_group(file_ast_tree, source, extension)
File "%/code2flow/engine.py", line 208, in make_file_group
file_group.add_node(language.make_root_node(body_trees, parent=file_group), is_root=True)
File "%/code2flow/python.py", line 229, in make_root_node
variables = make_local_variables(lines, parent)
File "%/code2flow/python.py", line 120, in make_local_variables
variables += process_assign(element)
File "%/code2flow/python.py", line 79, in process_assign
ret.append(Variable(token, call, element.lineno))
File "%/code2flow/model.py", line 159, in __init__
assert points_to

Call Location of Each Function In the JSON file

I want to get where each function is called in the JSON output file but I could not figure out how to do it. For example, if I have a main.py and it calls A(), I want to see A is called in main.py in the JSON file.

Request: Output all call sites which refer to a given function

Scenario: I have a method (ruby) defined in a model somewhere. I'd like to identify all call sites which call this method and call sites that refer to those call sites up to some given limit. This sounds like a subset of the graph which is generated.

Request for PHP support

From my experience I have seen the messiest code written in PHP. Hence I'd like to see support for PHP.

What do you think is required to implement a new language in code2flow?

Code2flow installs improperly, is added to PATH, and opens "How do you want to open this file?" menu

Following the instructions in the README, using python install setup.py, code2flow is added to PATH, but when trying to run, whether with a file or by itself, it instead opens a "How do you want to open this file?" menu.

If you select a text editor it will bring up this:

#!"C:\Users\[User]\AppData\Local\Programs\Python\Python39\python.exe"
# EASY-INSTALL-SCRIPT: 'code2flow==2.0.1','code2flow'
__requires__ = 'code2flow==2.0.1'
__import__('pkg_resources').run_script('code2flow==2.0.1', 'code2flow')

Uninstalling and reinstalling it does nothing.

Using Python 3.9.1 on Windows 10.

Request: Allow depth/downstream-depth without `--target-function`

I'm trying to use code2flow on a very large codebase and the resulting out.png file keeps getting scaled to the point where it is unreadable.

I would like to be able to set a graph depth without having to pick a particular function.

code2flow my_package --downstream-depth 3

Or maybe just a generic --depth.

Scaled out.png file

image

I realize there's probably a way to get dot/graphwhiz to reduce the scaling, but I haven't figured that out yet. Also I only really care about the first few nodes in the graph.

Edit: changing the output type to .svg solved the issue with low res .png files. But I still think being able to set a depth without specifying a target function would be a good feature.

Very cool project BTW.

Create an org

Create an org, merge all the contributions into your repo, transfer it to the org, fork back into your acc, give all the contributors write rights in the org repo.

Re exception: bogus escape: '\\2' (Javascript)

Input file is called "main.js" (so nothing spectacular).

Here's the traceback (I tried to correct the output from Powershell):

PS C:\Users\xxx> ..\..\Python\2.7\python.exe .\Apps\code2flow-master\code2fl
ow .\Apps\code2flow-master\2graph\main.js
Mapping .\Apps\code2flow-master\2graph\main
Removing comments and strings...
Generating function nodes...
Traceback (most recent call last):
  File ".\Apps\code2flow-master\code2flow", line 151, in <module>
    groups,nodes,edges = mapper.map()
  File "C:\Users\xxx\Apps\code2flow-master\code2flowlib\engine.py", line 814, in map
    fileGroup = self.generateFileGroup(name=filename,source=source)
  File "C:\Users\xxx\Apps\code2flow-master\code2flowlib\languages\javascript.py", line 329, in generateFileGroup
    return Group(name=name,source=source,fullSource=source,isFunction=True)
  File "C:\Users\xxx\Apps\code2flow-master\code2flowlib\languages\javascript.py", line 79, in __init__
    super(Group,self).__init__(**kwargs)
  File "C:\Users\xxx\Apps\code2flow-master\code2flowlib\engine.py", line 215, in __init__
    self.newObjectPattern = self.generateNewObjectPattern()
  File "C:\Users\xxx\Apps\code2flow-master\code2flowlib\languages\javascript.py", line 170, in generateNewObjectPattern
    return re.compile(r'new\s+%s\s*\('%self.name)
  File "C:\Python\2.7\lib\re.py", line 190, in compile
    return _compile(pattern, flags)
  File "C:\Python\2.7\lib\re.py", line 244, in _compile
    raise error, v # invalid expression
sre_constants.error: bogus escape: '\\2'

fill-color for regular function

As highlighted in red rectangle in the bellow image, fill-color for regular function is inconsistent.
Seen from the code, the fillcolor property is not set for regular function, so the default color (light gray?) seems to be used.
I prefer filling it in light gray. What do you think?

image

Bug: TypeError: unhashable type: 'list'

Trying to create the graph for a moderate size rails pp gives me:

$ code2flow --language=rb --ruby-version 27 app/**/*.rb

...

Traceback (most recent call last):
  File "/usr/local/bin/code2flow", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/code2flow/engine.py", line 630, in main
    code2flow(
  File "/usr/local/lib/python3.9/site-packages/code2flow/engine.py", line 536, in code2flow
    file_groups, all_nodes, edges = map_it(sources, language, no_trimming,
  File "/usr/local/lib/python3.9/site-packages/code2flow/engine.py", line 346, in map_it
    subgroup.inherits = [nodes_by_subgroup_token.get(g) for g in subgroup.inherits]
  File "/usr/local/lib/python3.9/site-packages/code2flow/engine.py", line 346, in <listcomp>
    subgroup.inherits = [nodes_by_subgroup_token.get(g) for g in subgroup.inherits]
TypeError: unhashable type: 'list'

UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 4895: character maps to <undefined>

C:\Users\sterg\Documents\GitHub\sparks-baird\CrabNet\crabnet>code2flow model.py
Code2Flow: Found 1 files from sources argument.
Code2Flow: Implicitly detected language as 'py'.
Code2Flow: Processing 1 source file(s).
Code2Flow:   model.py
Traceback (most recent call last):
  File "C:\Users\sterg\AppData\Local\Programs\Python\Python39\Scripts\code2flow-script.py", line 33, in <module>
    sys.exit(load_entry_point('code2flow==2.2.0', 'console_scripts', 'code2flow')())
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\engine.py", line 625, in main
    code2flow(
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\engine.py", line 531, in code2flow
    file_groups, all_nodes, edges = map_it(sources, language, no_trimming,
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\engine.py", line 317, in map_it
    raise ex
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\engine.py", line 312, in map_it
    file_ast_trees.append((source, language.get_tree(source, lang_params)))
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\site-packages\code2flow\python.py", line 155, in get_tree
    tree = ast.parse(f.read())
  File "c:\users\sterg\appdata\local\programs\python\python39\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 4895: character maps to <undefined>

Python 3 support.

This module does not supports Python version 3, (or, so it seems). This is nowhere mentioned.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.