Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error with readme demo test #5

Open
alphatogo opened this issue Nov 14, 2024 · 1 comment
Open

Runtime error with readme demo test #5

alphatogo opened this issue Nov 14, 2024 · 1 comment

Comments

@alphatogo
Copy link

alphatogo commented Nov 14, 2024

Thank you for your contribution, but I encountered an issue when running cd.difference: AttributeError: partially initialized module 'code_diff' has no attribute 'difference' (most likely due to a circular import). Could you please help explain why this bug occurs?

import code_diff as cd

# Python
output = cd.difference(
    '''
        def my_func():
            print("Hello World")
    ''',
    '''
        def say_helloworld():
            print("Hello World")
    ''',
lang = "python")

# Output: my_func -> say_helloworld

output.edit_script()

# Output: 
# [
#  Update((identifier:my_func, line 1:12 - 1:19), say_helloworld)
#]


# Java
output = cd.difference(
    '''
        int x = x + 1;
    ''',
    '''
        int x = x / 2;
    ''',
lang = "java")

# Output: x + 1 -> x / 2

output.edit_script()

# Output: [
#  Insert(/:/, (binary_operator, line 0:4 - 0:9), 1),
#  Update((integer:1, line 0:8 - 0:9), 2),
#  Delete((+:+, line 0:6 - 0:7))
#]
@cedricrupb
Copy link
Owner

Sorry for the delayed answer. Sadly, I have no idea why this problem occurs. Did you fix the problem in the meantime? Or could you give some further hints about your setup? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants