Description
Imported pycode_similar as python library:
import pycode_similar
Have two files with python source code ('t1.py' and 't2.py' respectively):
from math import sqrt
x = float(input("x="))
y = float(input("y="))
r = float(input("r="))
h = sqrt(x2 + y2)
print("The distance to a point from the origin is %.2f" % h)
if h > r:
print("point is outside the circle")
else:
print("point belongs to circle")
and
import math
x_point = float(input("x = "))
y_point = float(input("y = "))
r_circle = float(input("R = "))
hypotenuse = math.sqrt(x_point ** 2 + y_point ** 2)
if hypotenuse <= r_circle:
print("The point belongs to the circle")
else:
print("The point does not belongs to the circle")
Read both of them as strings:
str_1 = open('t1.py', 'r').read()
str_2 = open('t2.py', 'r').read()
Tried to use pycode_similar.detect:
pycode_similar.detect([str_1, str_2], diff_method=pycode_similar.UnifiedDiff, keep_prints=True, module_level=True)
But nothing was output to the console.
What am I doing wrong ?