Skip to content

name 'UnifiedDiff' is not defined #2

Description

@zeydabadi

Hi,
I ran the following code in my jupyter-notebook. data[0] contains a string which is the path to a .py file.
import pycode_similar pycode_similar.detect([data[0], data[0]],diff_method=UnifiedDiff)
but I receive this error:
`--------------------------------------------------------------------------
NameError Traceback (most recent call last)
in
1 import pycode_similar
----> 2 pycode_similar.detect([data[0], data[0]],diff_method=UnifiedDiff)

NameError: name 'UnifiedDiff' is not defined
I ran the code like below:import pycode_similar
pycode_similar.detect([data[0], data[0]],diff_method='UnifiedDiff')`

and I got this error:
`---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
in
1 import pycode_similar
----> 2 pycode_similar.detect([data[0], data[0]],diff_method='UnifiedDiff')

~/deid2/lib/python3.6/site-packages/pycode_similar.py in detect(pycode_string_list, diff_method)
446 min_diff_func_info = None
447 for fi2 in func_info_candidate:
--> 448 dv = diff_method.diff(fi1, fi2)
449 if dv < min_diff_value:
450 min_diff_value = dv

AttributeError: 'str' object has no attribute 'diff'`

Can you please help me understand what I am doing wrong?

Thank you!

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